this is my script
local Mouse = game.Players.LocalPlayer:GetMouse() local animation = script.Parent:WaitForChild("Idle") local track = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(animation) track.Looped = true -------------------- local Remote = game.ReplicatedStorage.Box -------------------- local punch = script.Parent:WaitForChild("Punch") local track2 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(punch) cooldown = false local Char = game.Players.LocalPlayer.Character -------------------- local left = script.Parent:WaitForChild("Left") local track3 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(left) local punched1 = false debounce = false script.Parent.Equipped:Connect(function(Mouse) track:Play() end) script.Parent.Unequipped:Connect(function() track:Stop() end) Mouse.Button1Down:connect(function() if cooldown == false and punched1 == false then track2:Play() -------------------- Char["Right Arm"].Touched:Connect(function(Hit) if Hit.Parent.Humanoid and debounce == false then Hit.Parent.Humanoid:TakeDamage(5) punched1 = false cooldown = true debounce = true wait(0.5) cooldown = false debounce = false end end) ---------------- end -- if end)
Why when I click to punch whatever my right hand touches gets damaged and it doesnt stop? I want it to only damage a player once until i hit them again but its like a burst damage that keeps damaging anything that touches it
Hey there,
I could be wrong - but have you tried using debounce? This article may help you. If it doesn't work, feel free to leave a reply :-)
https://developer.roblox.com/en-us/articles/Debounce
Happy scripting!