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

How does :LoadCharacter work?

Asked by 10 years ago
function onTouched()
    :LoadCharacter()
end

script.Parent.Touched:connect(onTouched)

1 answer

Log in to vote
0
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
10 years ago

Load character works when called on a Player like below;

game.Players.M39a9am3R:LoadCharacter()

It will load your character, it is basically a respawn, or a reset without killing your character.


function onTouched(part) --Part hit it.
if part ~= nil then --Does it exist?
if part.Parent:FindFirstChild("Humanoid") then --Is it human?
local name = part.Parent.Name --Get their name.
if game.Players:FindFirstChild(name) then --Is there a player with that name?
    game.Players:FindFirstChild(name):LoadCharacter()
end
end
end
end

script.Parent.Touched:connect(onTouched)
0
ok, so I am making an (for example) and instead of killing the player with lava, i use LoadCharacter. How could I get it ot do onTouched? NinjoOnline 1146 — 10y
0
Can you edit your original post with what you have tried? M39a9am3R 3210 — 10y
0
edtitted NinjoOnline 1146 — 10y
0
thanks NinjoOnline 1146 — 10y
Ad

Answer this question