local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animation = Instance.new("Animation",character)
local animationId = "rbxassetid://4873199438"
if humanoid then
wait(3)
local loadAnimation = character.Humanoid:LoadAnimation(animationId)
loadAnimation:Play()
end
✓ ANSWER ACCEPTED
unable to cast value to object, why isn't my animation working?-
1 answer
✓ Accepted answer
You need to cast the AnimationObject to the Humanoid, not the ID:
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://"..4873199438
Animation.Parent = Character --// Secondary argument of Instance.new was deprecated
Character.Humanoid:LoadAnimation(Animation):Play()
If that helped, don’t forget to accept this answer!
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
thank you!