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

Get Character from Player?

Asked by 8 years ago

I want to know hot get the Character from a player

is there a way to do this?

Instead of the ':GetPlayerFromCharacter()' method is there like an opposite of that? Like 'GetCharacterFromPlayer()'?

2 answers

Log in to vote
1
Answered by
Zerio920 285 Moderation Voter
8 years ago

I'll give you the code I use for this:

local player = --etc

if not player.Character then
    print("waiting for character")
    player.CharacterAdded:wait();
    char = player.Character
else
    char = player.Character
end
0
Thanks GeezuzFusion 200 — 8y
Ad
Log in to vote
1
Answered by 3 years ago

It's faster to type

Char = player.Character or player.CharacterAdded:wait()
0
Lol 5 years late AlexanderYar 788 — 3y

Answer this question