Hello, I Need help making Respawn button to respawn the player after death, the problem is when the player is dying he automatically respawns again, i want it to respawn only after clicking Respawn Button, if you can help please tell me
This is relatively an easy thing to solve thanks to a couple of useful player apis
We can use game.Players.CharacterAutoLoads
and set it to false to stop players from spawning automatically, and whenever you want to load the character you can just use Player:LoadCharacter()
If you want the button to respawn the player, you can either hackily just use a sever script in the GUI, or you can use a remote event to from client-to-server as Player:LoadCharacter is a server-only method (pretty sure at least)
You can make a remote event and put it in replicatedstorage called revive and in a local script, when the player clicks the button make the remote event fire
respawnEvent:FireServer(player)
and in a server script put simply its to fire the event
local respawnEvento = script.Parent.Respawn
respawnEvent.OnServerEvent:Connect(function(player)
player:LoadCharacter()
end)```
also make the respawntime of the player becomes a higher number to avoid he respawn soon
it is located in the player properties in the studio
Thank you so much! It worked
nice, mark as solution to close the post