Animation not playing

Hello developers

I have a script that runs an animation, but it isn’t working at all.

this is my code:

-- The parent of the script is a TextButton

local Player = game.Players.LocalPlayer
local Character = Player.CharacterAdded:Wait() or Player.Character

local Humanoid = Character:WaitForChild("Humanoid")
local HRP = Character:WaitForChild("HumanoidRootPart")

local Animator = Humanoid:WaitForChild("Animator")

	local Animation = Animator:LoadAnimation(script.Parent.Animation)

for some reason the animation doesn’t play, the animation priority is on Action, and it is mine.

this is a pic of the explorer:


Looking at at first, there is probably 1 of 2 issues

Firstly, this line

local Character = Player.CharacterAdded:Wait() or Player.Character

Player.Character and Player.CharacterAdded:Wait() should be switched, if the character exists by the time the script is ran, it’ll wait for the Character regardless

Otherwise it could be something with the animation

Haha, thanks, that was so simple… :slight_smile:

1 Like