I'm trying to make an animation onTouch event, but I don't want to let the player move, so I made a command that changes the player walkspeed, but it is worst than before. The animation doesn't play properly, any help?
local Anim = script.Parent.Animation -- Animation
local debounce = false
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and debounce == false then
debounce = true
hit.Parent:findFirstChild("Humanoid").WalkSpeed = 0
local AnimTrack = hit.Parent.Humanoid:LoadAnimation(Anim)
AnimTrack:Play()
wait(2.8) -- Seconds Before You Can Play Animation Again.
debounce = false
hit.Parent:findFirstChild("Humanoid").WalkSpeed = 16
end
end)

1 comment
Are you trying to make like a talking + animation NPC?