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

Finished making my animation, how do I loop my animation?

Hello, my recent question has been solved on how to script an animation so it plays when you sit down, however my animation stays for a while and then disappears. Does anyone have an animation loop script? Thanks.

Here's the script:

script.Parent.ChildAdded:Connect(function(c) -- when a child is added (assuming the parent is the seat)
    if c:IsA("Weld") and c.Name == "SeatWeld" then -- if the added child is a weld and is named "SeatWeld"
        if c.Part1.Parent:FindFirstChildOfClass("Humanoid") then -- if the script finds a humanoid
            local anim = Instance.new("Animation") -- makes the animation
            anim.AnimationId = "rbxassetid://2521211373"  -- sets the id of it
            local track = c.Part1.Parent:FindFirstChildOfClass("Humanoid"):LoadAnimation(anim) -- loads the animation
            Track.Loop = true
            track:Play() -- plays the animation
        end
    end
end)

2 comments

0

I'm pretty sure you do that on the animation editor

0

AnimationTrack.Looped = true

1 answer

Import your animation onto the Animation Plugin you're using, click edit at the top and Set Priority to Action, then press Edit again and Set Looping to true, Finally export animation to override the one you previously made.

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