How do I loop a sitting animation?

I was looking at a roblox tutorial how to make a sitting animation like in these vibe games however you call it. I have done every step correct, but after testing it out the animation only goes 1 second and makes it’s default sit. Anyone do you have an idea how I can loop the animation?

2 Likes

Without any code it’s hard to tell what’s going on, but you could try setting AnimationTrack.Looped to true. AnimationTrack is the object returned from Humanoid:LoadAnimation. For example…

local Track = Humanoid:LoadAnimation(MyAnimation)
Track.Looped = true
Track:Play()

Should I make a new script or add this to my script?

Add it to whatever script plays the animation on the character.

Thank you so much, hofly this works…

Does not work, Humanoid and myanimation is orange underlined

I changed myanimation into sitanim.

You need to change Humanoid to the player’s Humanoid or game:GetService("Player").LocalPlayer.Character.Humanoid if in a localscript.

Tried on a regular script and in a localscript, it still does not work.

Can you post the script? We can’t help that much not knowing what’s going on.

This is my sitting animation script:

–Script–
seat = script.Parent
function added(child)
if (child.className==“Weld”) then
human = child.part1.Parent:FindFirstChild(“Humanoid”)
if human ~= nil then
anim = human:LoadAnimation(seat.sitanim)
anim:Play()
end
end
end

function removed(child2)
if anim ~= nil then
anim:Stop()
anim:Remove()
end
end

seat.ChildAdded:connect(added)
seat.ChildRemoved:connect(removed)

The spaces were actually how it was.

After line 6 (anim = human:LoadAnimation(seat.sitanim)) add this: anim.Looped = true

So instead of anim = human:LoadAnimation(seat.sitanim) , anim = human:LoadAnimation(seat.sitanim)

No, add the line, so it looks like this:

if human ~= nil then
anim = human:LoadAnimation(seat.sitanim)
anim.Looped = true -- here!
anim:Play()
end

I will try it later, something isn’t right and still nothing works…

I have to do something, see you later.

In the animation editor you have to set the animation priority to idle instead of core

Finally! Thank you so much! I hope I will keep that in mind.