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

What does :GetPlayerFromCharacter mean?

Asked by 10 years ago

script.Parent.Touched:connect(function(t) player = game.Players:GetPlayerFromCharacter(t.Parent)

What does that mean?

2 answers

Log in to vote
3
Answered by 10 years ago

It means get the Player object that is linked to that Character. A Character is actually just the 3D model we recognize as players in-game, but, technically, the Player could exist without the Character. The Player holds important information like the userId, TeamColor, and more.

Ad
Log in to vote
1
Answered by 10 years ago

GetPlayerFromCharacter() will return the player associated with the character or nil if you give it something that is not a character. For example game.Players:GetPlayerFromCharacter(game.Workspace.Player1) will return game.Players.Player1

Answer this question