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

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

Asked by 10 years ago

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

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

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.

0
Thanks! :) notes4u99 65 — 10y
Ad

Answer this question