This item is not replicated across Roblox’s server/client boundary.
This property can only be read from. Attempting to write to it will cause an error.
This is a read-only property which contains a reference to the
Player instance for which a
LocalScript is running. For
Scripts running on the server, this property is nil.
This property is useful when creating GUIs that display information about the player. You can use it to accessing the player’s
When creating loading GUIs using
ReplicatedFirst, sometimes a
LocalScript may run before the
Players/LocalPlayer is created and becomes available. In such cases, it is useful to yield until it is by using
local Players = game:GetService("Players") local player = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer'):wait()
Note that this technique is not required for
LocalScripts within in
StarterCharacterScripts, as these kinds of scripts only run if the
Player object is already available.
Setting the Player's Account Age
This example demonstrates how the
Player/SetAccountAge function would be used if it was accessible. It sets the local player’s account age to 100 days.
This example demonstrates the
First, the script changes the local player’s appearance by changing the
Player/CharacterAppearance property to the userId 772462. Then, the script fires the LoadCharacterBlocking function to reload the player’s character with the new appearance.
- This function cannot be used in scripts, but is usable in the command bar. As such, this example will only work as expected when fired from the command bar.
- Since this function executes asynchronously, the script will not continue execution until the function finishes.