Animation Script not working

Hello Developers, I’m @avoidingsolo, a programmer here on roblox. I was trying to create an animation script earlier just now but it did not seem to work. I am not very familiar with animations, so please help me out.

My Script:

local plr = game.Players.LocalPlayer
wait(4)
local anim = plr.Character.Humanoid:LoadAnimation(script.Animation)
anim:Play()

^^
Local Script under StarterGui, with the animation underneath with the animationID already input.

Are you getting any errors on the Output at all? :thinking: I do have a couple of questions to ask before we head straight into the issue

  • Is the animation owned by you? If not, is it owned by a group of some sort?

  • Is script.Animation an Animation Object?

  • Is the AnimationPriority set to Action?

1 thing I noticed is that you aren’t detecting for the Character variable, it could be possible that the Character you’re trying to find could still be nil in this Instance

I’d try calling WaitForChild() when you define your variables, and creating a local variable for the Character cause it may be possible that your Character could still be loading by the time it starts to play the animation perhaps

local plr = game.Players.LocalPlayer
local Character = plr.Character or plr.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Animation = script:WaitForChild("Animation")

wait(4)
local LoadAnim = Humanoid:LoadAnimation(Animation)
LoadAnim:Play()
  • The animation is owned by my client whom I am scripting for.

  • Yes, I am 100% sure that it is.

  • How do I check that? I am not sure if it is.

And no, there are no errors in my output.

I think that might be the reason why

If the Animation is owned by someone else, you won’t be able to play their animation unless if they’re both the owner of the game, and they own the animation itself

You could try asking your client to give the Animation file so that way you could Upload & Export it to ROBLOX that way?

Alright thanks a lot for your help.