I think you mean you wanna get all players in one variable, and others are being confused that you wanna get the local player, because of the question title, Avigant
answered correct, if you just wanna get the local player use game.Players.LocalPlayer
and to get all use game.Players:GetPlayers()
but you need more explanation :
LocalPlayer : A property of Player Service, it's an object value, and the value is your player, you maybe wondering There are a lot players, but it's just one object value, the fact is you need to use local scripts to get local player, you can put local scripts in services like StarterGui, Backpack, StartPlayerScripts, StarterCharacterScripts
, when player joins game clones local scripts separately for each player, and they run separately, means if you change anything for a player with local script and your game is fe only local player can see it.
Local Variables : I think you know what are variable, and you had understood what does local exactly mean, but here is a another example :
a :
b :
so that were some more example of local
stuffs
and you need table for what you want to do in this question, there are a lot variable types like Boolean, Int, Number, Object, String, Table, EnumValues, Color3, BrickColor
and a lot more
Tables : a variable type that holds more than one values, they are also called arrays
, a table can hold any variable for example :
3 | Object = workspace.Part, |
5 | Color = Color 3. new( 1 , 1 , 1 ), |
so now if you type print(test.String)
it would print abc and if you type print(test.Number)
it would print 123 and if you type test.Object:Destroy()
it would destroy workspace.Part
so the thing you can do with players that's :
1 | local Players = game.Players:GetPlayers() |
2 | for _, plr in pairs (Players) do |
5 | print (plr.Character.HumanoidRootpart.Position) |
I hope i answered the thing you want to know, thanks for reading.
Locked by User#24403
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?