Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why doesn't the animation stop when I move?

anims = {
    ["lay"] = "rbxassetid://1" 
}


game.Players.PlayerAdded:connect(function(player)
wait(0.025)
local usinganim = false
wait()
player.CharacterAdded:connect(function()
wait()
player.Character.Humanoid.Running:connect(function()
	print("hi")
    if usinganim ~= false then
	print("hi")
    usinganim:Stop()
    usinganim = false
    
end
end)
end)
player.Chatted:connect(function(msg)
local foundmessage = false
for i,v in pairs(anims) do
if msg == "/e " .. i then
foundmessage = i
end
end
if foundmessage ~= false then
local anim = Instance.new("Animation")
anim.AnimationId = anims[foundmessage]
anim = player.Character.Humanoid:LoadAnimation(anim)
anim:Play()
usinganim = anim
end
end)
end)

1 answer

You can use a Wait () depending on how long your animation lasts.

anim:Play()

Wait(1)

anim:Stop()

This discussion is preserved as it was. New answers, comments, and votes are closed.