I only 2 ways,
local Player = game.Players.LocalPlayer
and local Player =
Brick.Parent:findfirstChild("Humanoid")
Can you guys tell em any more ways?
Thanks.
There are several ways to get the Player from the client or server
Client side
First and most common method is:
game:GetService'Players'.LocalPlayer
The other way is to do:
game.Players.LocalPlayer
But this method is deprecated, so you shouldn't do it this way
Server side
The easy way to access a player is:
game:GetService'Players':FindFirstChild(PlayerName)
But make sure to have an if statement checking if the player exists
Another way is to do:
game:GetService'Players'[PlayerName]
A way to access a player from character is to do:
game:GetService'Players':GetPlayerFromCharacter(workspace.PlayerName)
This also works on client side, but more commonly used server side
game.Players.LocalPlayer
is for accessing the player of the client the script is running on.
GetPlayerFromCharacter will return a player given their character.