Animation Not Playing

I have a script that will play a animation whenever a person gets low health, but for some reason the animation won’t play.

Script:

local character = script.Parent

local humanoid = character:WaitForChild(“Humanoid”)

local animation = game.ReplicatedStorage:FindFirstChild(“Low Life Animation”)

local loadedAnimation = humanoid:LoadAnimation(animation)

humanoid.HealthChanged:Connect(function(health)

if health <= 40 then

loadedAnimation:Play()

else

loadedAnimation:Stop()

end

end)

Nevermind, I was able to fix it. My script was in “StarterPlayerScripts” instead of “StarterCharacterScripts”.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.