The information on this page may no longer be accurate. To see the latest, go to our new and improved documentation. You can also learn more about the future of documentation.
Collapse Sidebar


The LocalPlayer will be set automatically when a client connects to the game, so uses for this method are extremely limited. This function is protected, attempting to use it in a Script or LocalScript will cause an error.

Although you cannot create the LocalPlayer, you can reference the LocalPlayer created by a game using the following code in a LocalScript:

	local player = game.Players.LocalPlayer


Return Type Summary

Code Samples

Creating a LocalPlayer

This example demonstrates that the Players/CreateLocalPlayer function executes without error if using the Command Bar or a Plugin and errors if executed in a LocalScript.