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

What does :GetPlayerFromCharacter mean?

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

What does that mean?

2 answers

✓ Accepted answer

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.

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

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