Hello, so I'm having trouble with a script. I want to make it so that when you step on a part, it will change your walkspeed for a limited time. But when I try it, it doesn't work. Can anyone help me fix it, please?
local Anim = script.Parent.Animation
local debounce = false
h.WalkSpeed = 0
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and debounce == false then
debounce = true
local AnimTrack = hit.Parent.Humanoid:LoadAnimation(Anim)
AnimTrack:Play()
debounce = true
h.WalkSpeed = 16
end
end)

4 comments
Sorry, but this didn't work for me. What I'm trying to do is that the walkspeed will be 0 when you touch the part, and after my custom animation is done playing, it will be back at 16. (R6 btw).
Oh! Okay gotcha!
That should do it for ya!
Idk if I'm doing something wrong, when I stepped on the part, I could still walk while the animation is playing.