script.Parent.Touched:connect(function(t) player = game.Players:GetPlayerFromCharacter(t.Parent)
What does that mean?
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