Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --clockwork
- --Fix implemented by Luckymaxer
- HopperBin = script.Parent
- Sound = HopperBin:WaitForChild("Sound")
- Debris = game:GetService("Debris")
- function TagHumanoid(humanoid, player)
- local Creator_Tag = Instance.new("ObjectValue")
- Creator_Tag.Name = "creator"
- Creator_Tag.Value = player
- Debris:AddItem(Creator_Tag, 2)
- Creator_Tag.Parent = humanoid
- end
- function UntagHumanoid(humanoid)
- for i, v in pairs(humanoid:GetChildren()) do
- if v:IsA("ObjectValue") and v.Name == "creator" then
- v:Destroy()
- end
- end
- end
- function FindCharacterAncestor(Parent)
- if Parent and Parent ~= game:GetService("Workspace") then
- local humanoid = Parent:FindFirstChild("Humanoid")
- if humanoid then
- return Parent, humanoid
- else
- return FindCharacterAncestor(Parent.Parent)
- end
- end
- return nil
- end
- function ExplosionHit(Explosion)
- Explosion.Hit:connect(function(Hit)
- if Hit and Hit.Parent then
- local character, humanoid = FindCharacterAncestor(Hit)
- if character and character ~= Character and humanoid and humanoid.Health > 0 then
- UntagHumanoid(humanoid)
- TagHumanoid(humanoid, Player)
- Hit:BreakJoints()
- end
- end
- end)
- end
- function Explode(Position)
- local Explosion = Instance.new("Explosion")
- Explosion.BlastRadius = 10
- Explosion.BlastPressure = 0
- Explosion.ExplosionType = Enum.ExplosionType.NoCraters
- Explosion.Position = Position
- ExplosionHit(Explosion)
- Explosion.Parent = game:GetService("Workspace")
- end
- function Button1Down(Mouse)
- local StartPos = Head.Position
- local Delta = Mouse.Hit.p - StartPos
- local Unit = Delta.unit
- Sound:Play()
- for i = 0, 75 do
- Explode(StartPos + Unit * 20 + i * Unit * i / 25)
- wait(0.05)
- end
- end
- function Selected(Mouse)
- Backpack = HopperBin.Parent
- Player = Backpack.Parent
- Character = Player.Character
- Humanoid = Character:FindFirstChild("Humanoid")
- Head = Character:FindFirstChild("Head")
- if not Player or not Character or not Humanoid or Humanoid.Health == 0 or not Head then
- return
- end
- Mouse.Button1Down:connect(function()
- Button1Down(Mouse)
- end)
- Mouse.Icon = "rbxasset://textures\\GunCursor.png"
- end
- HopperBin.Selected:connect(Selected)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement