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

How do you loop a seating animation using workspace?

Asked by 4 years ago

How can you loop this animation? the remote event is linked to when the player is seated.

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
    local anim = Instance.new("Animation")
    anim.AnimationId = "http://www.roblox.com/asset/?id=507771019"
    local loadedanimation = game.Workspace[player.Name].Humanoid:LoadAnimation(anim)
    loadedanimation.Looped = true
    loadedanimation:Play()
end)

2 answers

Log in to vote
0
Answered by 4 years ago

I don't understand what you're saying, but I do know that this might work.

while true do
    if player.Sit == true then
        game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
            local anim = Instance.new("Animation")
            anim.AnimationId = "http://www.roblox.com/asset/?id=507771019"
            local loadedanimation = game.Workspace[player.Name].Humanoid:LoadAnimation(anim)
            loadedanimation.Looped = true
            loadedanimation:Play()
        end)
    end
end

Also, not being offensive or anything but please put more effort into your question.

Ad
Log in to vote
0
Answered by
Necro_las 412 Moderation Voter
4 years ago
Edited 4 years ago

You can use an LoadedAnimation:Stopped() event and re-set the TimePosition of the track in the time you want it to loop from. See what is the time counting of the point you want to loop from and put in the xx below:

loadedanimation:Stopped():Connect(function()
            loadedanimation.TimePosition = xx
        end)

In this case it is supposed to take the animation back to that point. But if you want to freeze the animation in its TimePosition you can change the Speed property to 0 alike - or:

loadedanimation:AdjustSpeed(0)
0
If it doesn't work for some reason, use an Animation Event a milisecond before the end of the animation instead of a Stopped event. Necro_las 412 — 4y

Answer this question