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

How do you loop a seating animation using workspace?

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

✓ Accepted answer

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.

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)

2 comments

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.

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