How would I stop an animation without making another animation? I tried anim:Stop() but it didnt work.
local Player = game.Players.LocalPlayer Mouse = Player:GetMouse() play = false Mouse.KeyDown:connect(function(Key) if(Key:lower() == "f") and play == false then anim = Player.Character.Humanoid:LoadAnimation(script.animTest) anim:Play() Player.Character.Humanoid.WalkSpeed = 20 play = true if(Key:lower() == "f") and play == true then anim = Player.Character.Humanoid:LoadAnimation(script.animTest) anim:Stop() Player.Character.Humanoid.WalkSpeed = 16 play = false end end end)
I'm not sure if you're wanting it to be timed; so here is what I came up with so that after a certain about of time; the animation will stop itself instead of having to KeyDown again. If this isn't what you wanted, you can let me know.
local Player = game.Players.LocalPlayer Mouse = Player:GetMouse() Play = false Mouse.KeyDown:connect(function(Key) if(Key:lower() == "f") and play == false then anim = Player.Character.Humanoid:LoadAnimation(script.animTest) anim:Play() Player.Character.Humanoid.Walkspeed = 20 Play = true wait(5) -- Change this value to whatever you want anim:Stop() Player.Character.Humanoid.Walkspeed = 16 Play = false end end)
You're doing it correctly. anim:Play() Plays it.. anim:Stop() Stops it. Works for my animations. Probably other error in the script.