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

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

Asked by
zadobyte 692 Moderation Voter
4 years ago
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

Log in to vote
1
Answered by
pwx 1581 Moderation Voter
4 years ago

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()
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. zadobyte 692 — 4y
Ad

Answer this question