So I have the code in a Script in StarterCharacterScripts and it works locally but not on a server. I figured I'd ask here because its probably something small I overlooked, so if anyone could point out my problem it would be greatly appreciated!
local character = script.Parent local humanoid = character:WaitForChild("Humanoid") local dead = script.Dead humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false) local deathAnimation = humanoid:LoadAnimation(script.Death) humanoid.HealthChanged:Connect(function() if humanoid.Health <= 0 and dead.Value ~= true then humanoid.Health = 0 dead.Value = true deathAnimation:Play() wait(0.5) humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, true) end end)