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

Animation not looping properly?

Asked by 4 years ago

Hi I'm writing this game which requires animations for the npcs. I have stuff where I want the animation to loop forever. I'm not sure why but it only plays once and then stops. If I run it (not like with player. just running it) it works fine. I have a local and non local script that are duplicates and it doesn't do anything.

Code:

local Humanoid = script.Parent:WaitForChild("Humanoid")
local animationTrack = Humanoid:LoadAnimation(script.NPCIdle) -- The animation is in the script

animationTrack.Looped = true
animationTrack:Play()

1 answer

Log in to vote
0
Answered by 4 years ago

I'm having the same problem for my idle animation in my NPC and haven't completely fixed it, but I know that the problem has to do with the animation itself. Try to export the animation without the loop being toggled in the animation editor, that MIGHT work. Also, check to see if you have more than one of the same part in the same position, I found something like that in my NPC that isn't working. When I removed that extra part, I think it helped with the looping for one of my other animations.

0
I figured out how to fix by making it a local script. Looping is a local function and will not effect anyone besides the server because it is a local function. Create local script and loop it there. sen_trix 31 — 4y
Ad

Answer this question