Ok I AM ALMOST DONE WITH THIS ANIMATION SCRIPT!! JUST 1 MORE PROBLEM!!
People love Thumbing down my questions as if I've done something wrong.. and it's annoying... when I ask a question someone thumbs down of course and they dont even bother to answer.
Ok I made this and, when I press and Hold Q my WalkSpeed goes to 30 like I'm asking it to, AND my run animation starts! So, the first part is perfect.. but when I Release Q My Walkspeed Returns to 16 as it should but my animation doesnt stop! How do I stop it?!
wait(2)
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local humanoid = player.Character.Humanoid --Humanoid
Mouse.KeyDown:connect(function(key)
if key:lower() == "q" and humanoid then --I added ":lower()" incase they had caps lock on. I also added "and humanoid" just to see if it exists.
s = humanoid:LoadAnimation(game.StarterPack.AnimScrip2.Animation)
s:Play()
humanoid.WalkSpeed = 30 --Change the speed
end
end)
Mouse.KeyUp:connect(function(key)
if key:lower() == "q" and humanoid then
s = humanoid:LoadAnimation(game.StarterPack.AnimScrip2.Animation)
s:Stop()
humanoid.WalkSpeed = 16
end
end)

1 comment
try making the "s" variable global.