Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How could you make this script teleport the player back after reseting?

The player teleports when joined, but if they reset they don't teleport back. I tried messing around with some other ideas but I forgot what I used and lost those versions.

local Teleporter = game.Workspace.TeleportPart

game:GetService("Players").PlayerAdded:connect(function(p)
	p.CharacterAdded:connect(function(character)
		if p:GetRankInGroup(00000) >= 0 or p:GetRankInGroup(00000) >= 0 or p.Name == "Player1" then
			p.Character.Torso.CFrame = Teleporter.CFrame * CFrame.new(0,3,0)
		end
	end)
end)

1 comment

0

Anyone?

1 answer

To do things upon a player reset, you should use the Died() event, It fires once an player dies and must to be connected to an humanoid.

local Teleporter = game.Workspace.TeleportPart

game:GetService("Players").PlayerAdded:connect(function(p)
    p.CharacterAdded:connect(function(character)
        if p:GetRankInGroup(00000) >= 0 or p:GetRankInGroup(00000) >= 0 or p.Name == "Player1" then
            p.Character.Torso.CFrame = Teleporter.CFrame * CFrame.new(0,3,0)
		p.Character:WaitForChild('Humanoid').Died:connect(function)
			repeat wait()
			until p.Character:WaitForChild('Humanoid').Health > 0 -- wait until the character revives
			p.Character.Torso.CFrame = Teleporter.CFrame * CFrame.new(0,3,0) -- teleports the player
		end)
        end
    end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.