Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

respawn player on touch?

Asked by
7_Fig 0
4 years ago

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

0
Player:LoadCharacter() DeceptiveCaster 3761 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago
Edited by royaltoe 4 years ago

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

0
Yep, was about to comment the same answer. Def a better way to do this than hasanchik's answer. proqrammed 285 — 4y
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 royaltoe 5144 — 4y
0
I am confused, do I use LoadCharacter on a character or player? PrismaticFruits 842 — 4y
Ad
Log in to vote
-1
Answered by 4 years ago

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)
0
After you insert this script, you should go to players and set respawn time to 0 User#30241 0 — 4y

Answer this question