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 5 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 — 5y
1
:playerFromCharacter is not a method. GetPlayerFromCharacter is User#19524 175 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 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 — 5y
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 — 5y
0
can you tell me the difference between () and []? Sounds like I could use it too xD xxXTimeXxx 101 — 5y
Ad

Answer this question