This is my script: wait() local Humanoid = script.Parent.Humanoid Humanoid.BreakJointsOnDeath = false local DA = Instance.new("Animation") DA.AnimationId = "rbxassetid://6101308551" local DeathAnimation = Humanoid:LoadAnimation(DA)
Humanoid.HealthChanged:Connect(function(Health) if Health <= 0 then print("died") script.Parent.HumanoidRootPart.Anchored = true DeathAnimation:Play() wait(2) script.Parent:Destroy()
end
end)
This is because the humanoid is not currently loaded in. You have to wait for it, like this:
local Humanoid = script.Parent:WaitForChild("Humanoid")
i figured out when this happens, DON'T call :Destroy() on player, use :Remove() instead.
I had the same problem and I just did this. This script deletes everything except the humanoid. Here is the script:
for _,v in pairs(char:GetChildren()) do if v.ClassName == "Humanoid" then wait() else v:Destroy() end end