Hi, I'm making an obby and I want to make it so if you fall you get respawned instantly when you touched the part that has the script
This isn't a request site, but I'm feeling nice right now. First, we'll make use of the Touched
event in a server script. This assumes that you have a server script inside a part in the workspace:
1 | local part = workspace.Part |
2 |
3 | part.Touched:Connect( function (hit) |
4 | local plr = game:GetService( "Players" ):GetPlayerFromCharacter(hit.Parent) |
5 | if plr then |
6 | plr:LoadCharacter() |
7 | end |
8 | end ) |
We use the :GetPlayerFromCharacter()
method to find the character's player, and then load the character from there, which respawns the character.