local debounce = false
local plr = game.Players.LocalPlayer
local PunchBag = workspace.PunchBag
script.Parent.MouseButton1Click:Connect(function()
if not debounce then
debounce = true
plr.leaderstats.Speed.Value = plr.leaderstats.Speed.Value + 5
print(“button was pressed!”)
wait(2)
debounce = false
end
end)
I’m assuming you want the humanoid to touch the physical part?
script.Parent.Touched:Connect(function(hit)
if hitParent:FindFirstChildWhichIsA("Humanoid") then
local debounce
if not debounce then
debounce = true
plr.leaderstats.Speed.Value = plr.leaderstats.Speed.Value + 5
print(“button was pressed!”)
wait(2)
debounce = false
end
end)
local debounce = false
local plr = game.Players.LocalPlayer
local PunchBag = workspace.PunchBag
script.Parent.MouseButton1Click:Connect(function()
if not debounce then
debounce = true
-- Play your animation here --
PunchBag.Touched:Connect(function(hit)
if hit.Name == "RightHand" or "RightLowerArm" or "RightUpperArm" or "RightArm" or "LeftHand" or "LeftLowerArm" or "LeftUpperArm" or "LeftArm" then
plr.leaderstats.Speed.Value = plr.leaderstats.Speed.Value + 5
print(“button was pressed!”)
wait(2)
debounce = false
end
end
end)
end)