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
COMMUNITY QUESTION
Player touched a part and gets respawned?
1 answer
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:
local part = workspace.Part
part.Touched:Connect(function(hit)
local plr = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if plr then
plr:LoadCharacter()
end
end)
We use the :GetPlayerFromCharacter() method to find the character's player, and then load the character from there, which respawns the character.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Not sure the exact scenario this would be used in, but I would recommend you use WaitForChild to ensure the part has been loaded.
yes it was just an example, although i rarely have to wait for anything in workspace.