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

What does game.Players.LocalPlayer mean?

Asked by 10 years ago

What does game.Players.LocalPlayer mean?

4 answers

Log in to vote
5
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

The way ROBLOX works, there are different computers doing different parts of the work.

The ROBLOX game server does most of the work. All Script objects are all run by the Server.

But, because the server is away over the network, if it did everything, the clients (players playing the game) would have a short delay before anything happens.

Imagine hovering over a button, and seeing it change color only 100ms after your mouse gets there, or your gun not firing for a second and then lagging behind the mouse.

LocalScripts are scripts which each client runs. They are specific to a particular player. Which player is decided by where the LocalScriptis (inside a Character, PlayerGui, Backpack).


The player whose computer is running the LocalScript is identified by the Players service's LocalPlayer property. (This property is nil when a regular Script asks for it).

It is a Player object, which is the object that has a Character, TeamColor, and userId property, as well as others.

Ad
Log in to vote
0
Answered by
iaz3 190
10 years ago

LocalPlayer is exactly what it says. The local player. It can only be accessed in a local script.

it is exactly like a normal player, it just provides easy access for local scripts.

Log in to vote
-1
Answered by 10 years ago

This means that it is getting the local player. So say you were in game and someone said players = game.Players.LocalPlayer... that means that it is getting you character since your the local player.

Log in to vote
-1
Answered by
Xoqex 75
10 years ago

It is basically what pull said. game.Players.LocalPlayer it goes into game, then into Players , then LocalPlayeris you, so when you go to players and get the local.Player, you are the local player. You can even get your character through it by doing game.Players.LocalPlayer.Character. Hope this helped.

Answer this question