Animation only runs when I "Run" studio and not "Play" / "Play Here"

I want to have animation run and loop

The animation will not run when I play the game

works when I play as run

not when I actually play
image

This is the code I have in script

local animation = script:WaitForChild('Animation')
local humanoid = script.Parent:WaitForChild('Humanoid')
local flip = humanoid:LoadAnimation(animation)
flip.Looped = true
flip:Play()
1 Like

I suggest changing the code to

local animation = script:WaitForChild('Animation')
local humanoid = script.Parent:WaitForChild('Humanoid')
local animator = humanoid:WaitForChild("Animator")
local flip = animator:LoadAnimation(animation)
flip.Looped = true
flip:Play()

Since LoadAnimation on Humanoid is deprecated.

2 Likes

I changed it but I still have the same problem

I am not able to repro this. Is anything else doing something to the model?

I fixed it, I just made the animation loop true in the animation editor itself instead of the script
image

Thanks for the help

1 Like