I want, player, to respawn after they die. I have, tried making changes, in UI, but it doesn’t work. I have, a script testing, game and some scripts, punishs you, so I want respawn player script to, fix it. If you know, how to make, it please help me.
if your using Humanoid.Health then I would take a look at this.
player.Character.Humanoid.Died:Connect(function()
--respawn player to a certain position
--give any necessary items back to the player.
end)
I have, default, healths system, I will try, your script, thanks, for sending it.
ok, best of luck bud, come back if you have any more questions
So how to use, it? I want, a player to respawn, after low health.
humanoid.Died fires automatically when the players health equals zero, you just need a script to connect to it, look at the reference page, it gives you good information.
I meant after dying! I want player, to respawn after dying, cause some of scripts, players are getting stuck.
So how, to set up script for that? Can you tell me.
in a server script try this code out.
game:GetService('Players').PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:Connect(function()
print(player.Name .. " has died!")
end)
end)
end)
source code from - Humanoid | Documentation - Roblox Creator Hub
Where to put this script in???
Server script service???
in ServerSciptService, don’t use a ‘local script’ for this.
Just a script? like normal script insert.
yeah, a normal script within ServerScriptService should work fine.
It will, respawn player if, his health is 0 aka dead.
no it just prints out a message telling you who died and it technically will respawn the player, but it wont respawn him to the position you want. (unless your using spawn pads)
you’ll have to do something like this
player.Character.HumanoidRootPart.Position = Vector3.new(0,0,0)
this will set the players position to 0,0,0.
I will need, to add humanoid, in starter player?
no every player has a Character model, and every Character model contains a Humanoid by default.
Soo i just have to put this script in secret script service to respawn player after death i don’t need positions its what i need
this will respawn the player to 0,0,0 when they die, you’ll have to change the Vector3, to whatever position you want them to respawn too.
(you can even just use CharactedAdded event and respawn the player when the character is re-added.)
game:GetService('Players').PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:Connect(function()
print(player.Name .. " has died!")
spawn(function()
player.Character.HumanoidRootPart.Position = Vector3.new(0,0,0)
end)
end)
end)
end)