Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Respawn AI after death isn't working?

Asked by
zomspi 541 Moderation Voter
4 years ago

I am trying to make an AI enemy respawn when the player dies, the script that Ihave isn't working, I get no errors.


plr = game.Players.LocalPlayer char = plr.Character z = script.Parent backup = z:clone() while true do wait(5) if char.Humanoid.Health == 0 then print("ded") z:Remove() wait(2) backup.Parent = game.Workspace backup.Head:MakeJoints() backup.Torso:MakeJoints() if z == nil then wait(4) backup.Parent = game.Workspace backup.Head:MakeJoints() backup.Torso:MakeJoints() end end end
0
Perhaps it would be helpful if you were to explain what exactly is happening and how its not working. Though if I were to give a recommendation, you should do Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false) to prevent the joints from breaking automatically, and renable it to true once you've restored it's health. climethestair 1663 — 4y

Answer this question