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

Anyone know why this won't play the animation I made?

local par = script.Parent
local idle1 = Instance.new("Animation")

while true do
	idle1.AnimationId = "rbxassetid://4508495460"
	wait(3)
	local control = Instance.new("AnimationController", par)
	local animationTrack = control:LoadAnimation(idle1)
	animationTrack:Play()
end

I'm trying to get this to play an idle, it's priority is set to action rn, I do own the animation, and I'm trying to get it to play on an NPC. I took the script right from https://developer.roblox.com/en-us/articles/using-animations-in-games, so anyone have a single clue what's wrong here?

1 answer

✓ Accepted answer

Why are you loading an animation in a while true do loop? Playing it if it has the loop ticked (when you you were in animation editor) should keep it running for as long as you need it to.

local animation = Instance.new('Animation')
animation.AnimationId = 'rbxasetid://0' -- change to animation id
local track = Humanoid:LoadAnimation(animation)
track:Play()

1 comment

0

Ah thanks, I think I might have been trying to play the animation from AnimationController and Humanoid, also, the while true do did prove to be useless. Thanks a lot man.

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