This member cannot be used in scripts, but is usable in the command bar.
The games uses this function is to create the
Players/LocalPlayer. Since this item is protected, attempting to use it in a
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
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
-- Command bar local player = game.Players:CreateLocalPlayer() -- Returns a `Player` instance for the created local player -- LocalScript local player = game.Players:CreateLocalPlayer() -- Errors