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

How to make Character that respawns?

Asked by 3 years ago
Edited 3 years ago

How would make a script that allows my custom character to respawn in the same position after death? This is what I have.

wait() local Humanoid = script.Parent.Humanoid local char = script.Parent local Player = game.Players.LocalPlayer

Humanoid.HealthChanged:Connect(function(Health) if Health <= 0 then local area = char.HumanoidRootPart.CFrame Player.Character = char wait(5) Player:LoadCharacter() char.HumanoidRootPart.CFrame = area end end)

0
It is a local script inside of the character. aeco_ux 5 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

There are a few script errors I have tried this script and it worked. Try this. name="Humanoid"

robo=script.Parent:clone()

while true do wait(1) if script.Parent.Humanoid.Health<1 then robot=robo:clone() robot.Parent=script.Parent.Parent robot:makeJoints() script.Parent:remove() end end

Tell me if it fails I'll try and make a new script if it fails.

0
Thank you so much, I will try and do this now. I have inspected the script, and it works perfectly except for one tiny problem, when the character respawns, it isn't made the Local player's character and it's spawn location isn't where it once was. aeco_ux 5 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

Hey aeco_ux. LoadCharacter() does not work on the client.

0
I see, I will try another way, thank you! aeco_ux 5 — 3y

Answer this question