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

Why am I stuck in my laydown animation position unless I reset?

I made a script in which your character types in chat "/e lay" they play a laydown animation which I've made and it works, but I realized after the player types that and the animation plays, they're stuck in that position until they reset. How do I fix the script so that after they type "/e lay" if they move while in that position, the lay down animation stops and they go back to normal?

Script:

game.Players.PlayerAdded:connect(function(Plr)
    Plr.Chatted:connect(function(msg)
        if msg == "/e lay" then -- You could replace the MSG with anything if you want
            A = Instance.new("Animation", Plr.Character)
            A.AnimationId = "http://www.roblox.com/Asset?ID=2674544973" -- Here replace the 00s with your Animation ID
            animTrack = Plr.Character.Humanoid:LoadAnimation(A)
            animTrack:Play()
        end
    end)
end)

========================================================================================================================================================

Video of what the animation looks like: https://gyazo.com/d7f6d8ea7a7ba47d87c5c7599b48b153

1 answer

✓ Accepted answer

You need to make it so the animation can stop.

To check if the player moved, you can use the Humanoid.Running api, view here: https://developer.roblox.com/api-reference/event/Humanoid/Running

Plr.Character.Humanoid.Running:Connect(function(speed)
if speed > 0 then
animTrack:Stop()
end
end)

Once you do that ^, you should be standing up and you should be able to walk normally again.

1 comment

0

Ohh, I feel stupid lol. Thank you.

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