Why this script isnt working

Hi, I need to play animations and i forgot how, so from what I readed on hub, i made script, but idk why it dont work

while wait(10)do
 local a=Instance.new("Animation")
 a.AnimationId="290bac2af86ba8e946b06cbbc294f43d"
 local anim = workspace.elektrarna.Worker.Humanoid:LoadAnimation(a)
 anim:Play()
 print(anim)
end

That Animation ID is not a proper ID.

You should find the asset ID, not the CDN Hash, for the Animation.

It’ll follow a syntax similar to: rbxassetid://12345678 or https://www.roblox.com/asset?id=12345678

1 Like

ok, but than i am very confused, because lenth of the animation loaded correctly (tested using print())

This is strange, and not intended behaviour. You should find the correct Asset ID for it to play.

1 Like

Did you make sure to upload the animation to Roblox from the animation editor? Otherwise, you will get a temporary ID from the animation editor plugin that doesn’t actually work.

That’s not a valid animation ID, so it’d be best if you found the actual animation ID. When you export the animation to Roblox, you should find the ID by going into Create → Animations → the animation, and copy the number in the URL (for example, it should be like 4322343 or something). That’s the correct animation ID, and using it should prevent any funky errors.

1 Like

the problem was, that it was anchored

Good job finding the error.
Regardless, please try to use the accurate animation ID from now on, as using any other variants could result in complications later on.

1 Like

yes the id was 2nd problem, but the aanchor was bigger problem