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

How to get player from character that is not controlled by player?

Asked by 6 years ago

Getting player from character that is controlled by player has a built in function

game.Players:playerFromCharacter(character)

does getting player from character that is not controlled by player have one too?

0
idk but you can make your own get player from charcter function Zendaya774isstupid 50 — 6y
1
:playerFromCharacter is not a method. GetPlayerFromCharacter is User#19524 175 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

here's a function you can make:

local function playerFromCharacter(char)
    local player=game.Players[char.Name]
    return player
end
0
I tried using game.Players:FindFirstChild(character.Name) (didnt work still nil). What difference did it have with game.Players[character.Name]? (Works) xxXTimeXxx 101 — 6y
0
i am not sure if i'm being honest with you, i started using [] these brackets more often and my scripts became more efficient Zendaya774isstupid 50 — 6y
0
can you tell me the difference between () and []? Sounds like I could use it too xD xxXTimeXxx 101 — 6y
Ad

Answer this question