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

My idle animation stops after a couple of seconds? (Loop is on)

Asked by 4 years ago
Edited 4 years ago
local tool = script.Parent

local anim = Instance.new("Animation")

anim.AnimationId = "http://www.roblox.com/Asset?ID=3481508555" 
local track

tool.Equipped:Connect(function()

    track = script.Parent.Parent.Humanoid:LoadAnimation(anim)

    track.Priority = Enum.AnimationPriority.Action

    track.Looped = true  --Loop doesn't work?

    track:Play()

end)

tool.Unequipped:Connect(function()

    if track then

        track:Stop()

    end

end)

I

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Animations seem to be a bit finicky at times when I've tried to deal with them but I've had some decent success with them. In the case of say, an idle animation, I'd recommend just changing the already available idle animations found within the player's character model through:

player.Character.Animate.idle.Animation1.AnimationId = --(Your animation ID)
player.Character.Animate.idle.Animation2.AnimationId = --(Your animation ID)

local idle =player.Character.Animate.idle.Animation1.AnimationId = --(Your animation ID)
player.Character.Humanoid:LoadAnimation(idle):Play()

All you have to do is store the old ID's into a variable for later use during the unequipped function. This is the way I've managed it at least. Not sure if this is the best method but it's what I use and it's been very successful for what I've been trying to achieve.

Also, for animations that you intend to have playing continuously, in the Animation Editor there should be a button that looks like a play button with an arrow wrapped around that's up next to time. You'll want to make sure that is on.

Ad
Log in to vote
0
Answered by 4 years ago

i think this may be an easy answer, before your tool.Equipped function add this

anim.Looped = true

i think this may loop the animation

Answer this question