01 | local player = game.Players.LocalPlayer |
02 | local character = player.Character or player.CharacterAdded:Wait() |
03 | local humanoid = character:WaitForChild( "Humanoid" ) |
04 | local animation = Instance.new( "Animation" ,character) |
05 | local animationId = "rbxassetid://4873199438" |
06 |
07 | if humanoid then |
08 | wait( 3 ) |
09 | local loadAnimation = character.Humanoid:LoadAnimation(animationId) |
10 | loadAnimation:Play() |
11 | end |
You need to cast the AnimationObject to the Humanoid
, not the ID:
1 | local Animation = Instance.new( "Animation" ) |
2 | Animation.AnimationId = "rbxassetid://" .. 4873199438 |
3 | Animation.Parent = Character --// Secondary argument of Instance.new was deprecated |
4 |
5 | Character.Humanoid:LoadAnimation(Animation):Play() |
If that helped, don’t forget to accept this answer!