Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What can be another name for the function "GetPlayerFromCharacter"?

What can be another name for the function "GetPlayerFromCharacter"? I believe that it can be another name for the word "in". For Example:

if game.Players:GetPlayerFromCharacter(Part.Parent) ~= nil then

What I see in this in words is: If the Player in Part.Parent(Which in this case is Workspace) exists(Not Nil), then...

Is this correct or am I seeing something wrong? Let me know. Thanks.

1 answer

✓ Accepted answer

Your reading of "the player in model" explains the purpose of GetPlayerFromCharacter, however, I don't think it is nearly as precise or technically accurate as could be. Here's a more precise way to read it:


I would read

game.Players:GetPlayerFromCharacter(model)

as

the player whose character is model


The line you supplied could then be read as

If there is a player whose character is (Part's parent) (the "player" is not nil) then

A shorter way to read the purpose of this line though would be:

If (Part's parent) is a player's character then



As a side note, note that the ~= nil is unnecessary. Just

if game.Players:GetPlayerFromCharacter(Part.Parent) then

Accomplishes the same; for if it is a Player, it will happen, if it is nil, it will not.

1 comment

0

Thanks! :)

This discussion is preserved as it was. New answers, comments, and votes are closed.