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

respawn player on touch?

how do i make it so when a player touches a brick they get respawned?

1 comment

0

Player:LoadCharacter()

2 answers

✓ Accepted answer

The above answer will kill the player. But if you want to make the character instantly respawn without falling apart you would use this:


script.Parent.Touched:Connect(function(hit)
	local player = game.Players:FindFirstChild(hit.Parent.Name)

	if player then
          	player:LoadCharacter()
	end
end)

Hopefully that worked out for you. If you liked this answer please thumbs up and accept as your answer.

All the best,

PrismaticFruits - obviously a very talented scripter

3 comments

0

Yep, was about to comment the same answer. Def a better way to do this than hasanchik's answer.

0

Edited and tested it in game. This will work now. How Prismatic had it before didn't quite work, but almost worked. He needed to check if the thing touching the part was a player. If it was a player then you have to call player's loadCharacter function. He was trying to call the LoadCharacter function on the part that was touching the script.Parent

0

I am confused, do I use LoadCharacter on a character or player?

You are just asking for a kill brick script:

--Variables--
local Brick = script.Parent
--End--

--Code--
local function PlayerTouched(Part)
	local Parent = Part.Parent
	if game.Players:GetPlayerFromCharacter(Parent) then
		Parent.Humanoid.Health = 0
	end
end

Brick.Touched:connect(PlayerTouched)

1 comment

0

After you insert this script, you should go to players and set respawn time to 0

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