PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

CreateLocalPlayer

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

Returns

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.