So I'm making a game and I want to have a GUI and when you click it your character respawns but I don't know how to code that, any help?
Actually, a nicer method would be to use player:LoadCharacter(), this will reload their character immediately. To use this script create a Remote Event object and place it in workspace. Call it "reload".
In a Local Script:
1 | script.Parent.MouseButton 1 Down:connect( function () |
2 | workspace.reload:FireServer() |
3 | end ) |
In a Server Script:
1 | workspace.reload.OnServerEvent:connect( function (player) |
2 | player:LoadCharacter() |
3 | end |