StarterPlayer

Show Deprecated
Not Creatable
Service

A service which allows the defaults of properties in the Player object to be set. When a player enters the server, each property of the player object is set to the current value of the corresponding property in StarterPlayer.

Additionally, you may add four objects to this service:

  • A StarterPlayerScripts instance, with scripts that run once for each player.
  • A StarterCharacterScripts instance, with scripts to add to each player's character every time they spawn.
  • A Humanoid instance named StarterHumanoid, which will be used as the default humanoid for each player's character.
  • A Model instance named StarterCharacter, which will be used as the character model for all players

A typical structure may look something like this:

StarterPlayer Tree

Code Samples

Displaying a Humanoid's Health and Name

1local humanoid = script.Parent
2
3humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.Viewer
4humanoid.HealthDisplayDistance = 0
5humanoid.NameDisplayDistance = 100
Setting a Player's Replication Focus

1local Players = game:GetService("Players")
2
3local PLAYER_NAME = "polarpanda16"
4
5local player = Players:WaitForChild(PLAYER_NAME)
6
7local part = Instance.new("Part")
8part.Parent = workspace
9part.Name = "ReplicationFocusPart"
10part.Anchored = true
11player.ReplicationFocus = part
Setting Camera Zoom Distance

1local Players = game:GetService("Players")
2
3local player = Players.LocalPlayer
4
5player.CameraMaxZoomDistance = 50
6player.CameraMinZoomDistance = 75

Summary

Properties

Describes the current game's permission levels regarding custom avatar animations from the website.

HIDDEN

Sets whether the character will automatically jump when hitting an obstacle on a mobile device.

The maximum distance the player's default camera is allowed to zoom out in studs.

The minimum distance in studs the player's default camera is allowed to zoom in.

Changes the default camera's mode to either first or third person.

Determines the starting value of Humanoid.JumpHeight for Player.Character.

Determines the starting value of Humanoid.JumpPower for Player.Character.

Determines the starting value of Humanoid.WalkSpeed for Player.Character.

Sets how the default camera handles objects between the camera and the player.

Lets developer overwrite the default camera mode for each player if the player is on a computer.

Lets developer overwrite the player's movement mode if the player is on a computer.

Lets developer overwrite the default camera movement mode for each player if the player is on a mobile device.

Lets developer overwrite the player's movement mode if the player is on a touch device.

Determines if a player can toggle mouse lock by default.

HIDDEN
NOT REPLICATED
HIDDEN
NOT REPLICATED
HIDDEN
NOT REPLICATED
HIDDEN
NOT REPLICATED
HIDDEN
NOT REPLICATED
HIDDEN
NOT REPLICATED
HIDDEN
NOT REPLICATED
HIDDEN
NOT REPLICATED
HIDDEN
NOT REPLICATED
HIDDEN
NOT REPLICATED
HIDDEN
NOT REPLICATED

Sets the distance at which this player will see other Humanoid's health bars. If set to 0, the health bars will not be displayed.

Whether or not the appearance of a player's character should be loaded.

Indicates whether characters spawning into an experience will have layered clothing accessories equipped on them.

NOT REPLICATED
NOT SCRIPTABLE

Sets the distance at which this player will see other Humanoid's names. If set to 0, names are hidden.

Determines if user-owned emotes are loaded when loading avatars.

Events

Methods

ClearDefaults(): void  


Properties

AllowCustomAnimations

The AllowCustomAnimations StarterPlayer property describes the current game's permission levels regarding custom avatar Animations from the website.

As such, this value cannot be changed from within the game. It can only be changed by changing the game's permission levels within the game's setting's page on the website.

This property is not intended for use in the game.

AutoJumpEnabled

The AutoJumpEnabled property sets whether the character will automatically jump when hitting an obstacle on a mobile device.

This property is copied from the StarterPlayer to a Player when they join the game. Following that. the value of this property is copied to Humanoid.AutoJumpEnabled property of the Player.Characters Humanoid on spawn. In other words, it is possible to set the auto-jump behavior on a per-character, per-player and per-game basis using these three properties.

CameraMaxZoomDistance

The CameraMaxZoomDistance StarterPlayer property sets the maximum distance in studs the camera can be from the character with the default cameras.

This property sets the default value of Player.CameraMaxZoomDistance for each player who joins the game. If this value is set to a lower value than StarterPlayer.CameraMinZoomDistance it will be increased to CameraMinZoomDistance.

CameraMinZoomDistance

The CameraMinZoonDistance StarterPlayer property sets the minimum distance in studs the camera can be from the character with the default cameras.

This property sets the default value of Player.CameraMinZoomDistance for each player who joins the game. If this value is set to a higher value than StarterPlayer.CameraMaxZoomDistance it will be decreased to CameraMaxZoomDistance.

CameraMode

The CameraMode StarterPlayer property sets whether cameras will be locked to first person or not when a player joins the game.

Sets the default value for Player.CameraMode for each player in the game.

The camera has two modes:

  1. First person
  2. Third person

The CameraMode Enum is used to set CameraMode, and determines when first and third person cameras should be used.

First-person

In first-person mode, the player's camera is zoomed all the way in. Unless there is a visible GUI present with the GuiButton.Modal property set to true, the mouse will be locked and the user's camera will turn as the mouse moves.

Third-person

In third-person mode, the character can be seen in the camera. While in third-person mode on Roblox:

  • You may right-click and drag to rotate your camera, or use the arrow keys at the bottom right-hand corner of the screen.
  • When you move your mouse, your camera does not change (unless you move the mouse to the end of the screen).
  • When you press any of the arrow keys, the user's character will face in the corresponding arrow key's direction.
  • You can zoom in and out freely.

Third-person is the default camera setting.

CharacterJumpHeight

CharacterJumpHeight determines the starting value of Humanoid.JumpHeight for a Player's Character. The value of this property defaults to 7.2 studs.

This property is only visible in the Properties window If StarterPlayer.CharacterUseJumpPower is set to false, as it would not be relevant otherwise.

Since this property is only relevant for characters being spawned in the future, changing it will not change any existing player characters. Changes to this property will only take effect when a player respawns.

CharacterJumpPower

CharacterJumpPower determines the starting value of Humanoid.JumpPower for a Player's Character. The value of this property defaults to 50 and when applied to the Players Humanoid it will be constrained between 0 and 1000.

This property is only visible in the Properties window If StarterPlayer.CharacterUseJumpPower is set to true, as it would not be relevant otherwise.

Since this property is only relevant for characters being spawned in the future, changing it will not change any existing player characters. Changes to this property will only take effect when a player respawns.

CharacterMaxSlopeAngle

CharacterMaxSlopeAngle determines the starting value of Humanoid.MaxSlopeAngle for a Player's Character. It defaults to 89°, so humanoids can climb pretty much any slope they want by default. When applied to the Player's Humanoid it will be constrained between 0 and 89.

Since this property is only relevant for characters being spawned in the future, changing it will not change any existing player characters. Changes to this property will only take effect when a player respawns.

CharacterUseJumpPower

CharacterUseJumpPower determines the starting value of Humanoid.UseJumpPower for a Player's Character. Toggling it will change which property is visible in the properties window: CharacterJumpHeight (false) or StarterPlayer.CharacterJumpPower (true). Defaults to true.

Since this property is only relevant for characters being spawned in the future, changing it will not change any existing player characters. Changes to this property will only take effect when a player respawns.

CharacterWalkSpeed

CharacterWalkSpeed determines the starting value of Humanoid.WalkSpeed for a Player's Character. This property defaults to 16.

Since this property is only relevant for characters being spawned in the future, changing it will not change any existing player characters. Changes to this property will only take effect when a player respawns.

DevCameraOcclusionMode

The DevCameraOcclusionMode StarterPlayer property sets how the default camera handles objects between the camera and the player.

This is the default property for players joining the game. It can be changed for individual players by settings the Player.DevComputerOcclusionMode.

The default value is Zoom (0): The camera will zoom in until there is nothing between the player and camera.

See DevCameraOcclusionMode for the different occlusion modes available. Sets how the default camera handles objects between the camera and the player.

DevComputerCameraMovementMode

The DevComputerCameraMovementMode StarterPlayer property lets the developer overwrite the player's camera mode if the player is on a computer.

This is the default property for players joining the game. It can be changed for individual players by settings the Player.DevComputerCameraMode.

If set to UserChoice then the player's camera movement mode will be determined by whatever the player set in the game settings. Otherwise, the mode will be set based on this property.

See DevComputerCameraMovementMode for the different camera modes available.

Note

This property has no affect on players not on a computer.

DevComputerMovementMode

The DevComputerMovementMove StarterPlayer property lets the developer overwrite the player's movement mode if the player is on a computer.

This is the default property for players joining the game. It can be changed for individual players by settings the Player.DevComputerMovementMode.

If set to UserChoice then the player's movement mode will be determined by whatever the player set in the game settings. Otherwise, the mode will be set based on this property.

See DevComputerMovementMode for the different movement modes available. Lets developer overwrite the player's movement mode if the player is on a computer.

Note

This property has no affect on players not on a computer.

DevTouchCameraMovementMode

The DevTouchCameraMovementMode StarterPlayer property lets the developer overwrite the player's camera mode if the player is on a touch device.

This is the default property for players joining the game. It can be changed for individual players by settings the Player.DevTouchCameraMode.

If set to UserChoice then the player's camera movement mode will be determined by whatever the player set in the game settings. Otherwise, the mode will be set based on this property.

See DevTouchCameraMovementMode for the different camera modes available.

Note

This property has no affect players not on a mobile device.

DevTouchMovementMode

The DevTouchMovementMode StarterPlayer property lets the developer overwrite the player's movement mode if the player is on a touch device.

This is the default property for players joining the game. It can be changed for individual players by settings the Player.DevTouchMovementMode.

If set to UserChoice then the player's movement mode will be determined by whatever the player set in the game settings. Otherwise, the mode will be set based on this property.

See DevTouchMovementMode for the different movement modes available. Lets developer overwrite the player's movement mode if the player is on a touch device.

Note

This property has no affect on players not on a touch enabled device.

EnableDynamicHeads

Not Scriptable

EnableMouseLockOption

The EnableMouseLockOption StarterPlayer property determines if a player can toggle mouse lock by default.

Mouselock will lock the player's cursor to the center of the screen. Moving the mouse will rotate the Camera and Player will move relative to the current rotation of the camera.

This property sets the value of Player.DevEnableMouseLock.

GameSettingsAssetIDFace

Hidden
Not Replicated

GameSettingsAssetIDHead

Hidden
Not Replicated

GameSettingsAssetIDLeftArm

Hidden
Not Replicated

GameSettingsAssetIDLeftLeg

Hidden
Not Replicated

GameSettingsAssetIDPants

Hidden
Not Replicated

GameSettingsAssetIDRightArm

Hidden
Not Replicated

GameSettingsAssetIDRightLeg

Hidden
Not Replicated

GameSettingsAssetIDShirt

Hidden
Not Replicated

GameSettingsAssetIDTeeShirt

Hidden
Not Replicated

GameSettingsAssetIDTorso

Hidden
Not Replicated

GameSettingsAvatar

Hidden
Not Replicated

GameSettingsR15Collision

Hidden
Not Replicated

GameSettingsScaleRangeBodyType

Hidden
Not Replicated

GameSettingsScaleRangeHead

Hidden
Not Replicated

GameSettingsScaleRangeHeight

Hidden
Not Replicated

GameSettingsScaleRangeProportion

Hidden
Not Replicated

GameSettingsScaleRangeWidth

Hidden
Not Replicated

HealthDisplayDistance

The HealthDisplayDistance StarterPlayer property sets the distance in studs at which this player will see other Humanoid's health bars. If set to 0, the health bars will not be displayed. This property is set to 100 studs by default.

To change the display distance for a player once they join the game, you can set the Player.HealthDisplayDistance property.

Note

If a Humanoid's health bar is visible, you can set the display type using Humanoid.DisplayDistanceType.

HumanoidStateMachineMode

Not Browsable

LoadCharacterAppearance

The LoadCharacterAppearance StarterPlayer property sets whether or not the appearance of a player's character should be loaded.

Setting this to false results in the player having no clothes (including hats), body colors, body packages or anything else related to the appearance of the player's avatar. By default, this property is set to true.

Setting this to true results in the player loading the appearance corresponding to the player's Player.CharacterAppearanceId.

If Player:LoadCharacterWithHumanoidDescription() is used, it can be advantageous to set StarterPlayer.LoadCharacterAppearance to false as the player's avatar is not required as all asset IDs to equip on the character will come from the passed in HumanoidDescription.

LoadCharacterLayeredClothing

Not Replicated
Not Scriptable

Indicates whether characters spawning into an experience will have layered clothing accessories equipped on them (Although Workspace.MeshPartHeadsAndAccessories also need to be enabled in the Workspace).

NameDisplayDistance

Sets the distance at which this player will see other Humanoid's names. If set to 0, names are hidden.

The NameDisplayDistance StarterPlayer property sets the distance in studs at which this player will see other Humanoid's names. If set to 0, names are hidden. This property is set to 100 studs by default.

To change the display distance for a player once they join the game, you can set the Player.NameDisplayDistance property.

Note

If a Humanoid's name is visible, you can set the display type using Humanoid.DisplayDistanceType.

UserEmotesEnabled

This property determines if user-owned emotes are loaded when loading avatars. Setting this property to false disables loading. Developers can set the property in Studio directly or through the Game Settings menu.

When emote loading is disabled, the emotes UI will still work as long as developers choose to use the emotes feature by adding emotes within their game.

See also:

  • Avatar Emotes, an article detailing how to control, customize, and play avatar emotes

Events

Methods

ClearDefaults

void
Roblox Script Security

Returns

void