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

How do I access game.Players.LocalPlayer.Character in a normal script?

Asked by 7 years ago

I'm trying to create a disaster script that will teleport the players to the lobby on death and when the round has started I want them to teleport to the baseplate. Can anybody show me how to access "Character" within the confinements of a normal script?

1 answer

Log in to vote
1
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago

I mostly use a for loop for this, to get all players as individual objects.

You can do the following to acces all individual players inside of the game.

for _,player in pairs(game.Players:GetPlayers()) do
    local Character = player.Character
    --do stuff for each character
end
0
btw, for death to lobby, i suggest you just put a spawn location inside of the lobby to make your life easier ^^ RubenKan 3615 — 7y
0
Yeah.Thanks for your help! I won't accept this answer until I have tried it. ZetaReticuli 38 — 7y
0
Thanks! It works!!!! ZetaReticuli 38 — 7y
Ad

Answer this question