The title is pretty self-explanatory. My action animation will not stop when being activated from a button on screen. Code:
local playing = false
script.Parent.MouseButton1Down:Connect(function()
local character = game.Players.LocalPlayer.Character
local hum = character:FindFirstChild("Humanoid")
local anim = hum.Animator:LoadAnimation(game:GetService("StarterPlayer").StarterCharacterScripts.CtoCrawl.Crawl)
if not playing then
hum.WalkSpeed = 8
anim:Play()
playing = true
elseif playing then
anim:Stop()
hum.WalkSpeed = 16
playing = false
end
end)
It’s still not working. The game let’s me go into the animation (Crawl animation) but I can’t get out. The speed still speeds up as if I wasn’t in the animation, but it’s just stuck.
local playing = false
script.Parent.MouseButton1Click:Connect(function()
local character = game.Players.LocalPlayer.Character
local hum = character:FindFirstChild("Humanoid")
local anim = hum.Animator:LoadAnimation(game:GetService("StarterPlayer").StarterCharacterScripts.CtoCrawl.Crawl)
if playing == false then
hum.WalkSpeed = 8
anim:Play()
playing = true
else
anim:Stop()
hum.WalkSpeed = 16
playing = false
end
end)
Nope, same thing is happening. I know it’s definitely anim.Stop() that’s not working. The walkspeed goes back to normal, but it’s just not stopping the animation. Thanks for trying though.