Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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

Log in to vote
0
Answered by
Astralyst 389 Moderation Voter
6 years ago
Edited 6 years ago

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.

0
Ohh, I feel stupid lol. Thank you. Incinerxte 2 — 6y
Ad

Answer this question