Class · inherits Instance
Player
An object that represents a presently connected client to the experience.
About Player
A Player object is a client that is currently connected. These objects are
added to the Players service when a new player connects, then removed
when they eventually disconnect from the server.
The Instance.Name property reflects the player's username. When saving
information about a player, you should use their UserId
since it is possible that a player can change their username.
There are several similar methods in the Players service for working
with Player objects. Use these over their respective Instance methods:
- You can get a table of current
Playerobjects usingPlayers.GetPlayers; again, use this instead ofInstance.GetChildren. - To detect the addition of
Playerobjects, it is recommended to use thePlayers.PlayerAddedevent (instead ofInstance.ChildAddedon thePlayersservice). - Similarly, you can detect the removal of
Playerobjects usingPlayers.PlayerRemoving, which fires just before thePlayeris removed (instead ofInstance.ChildRemovedwhich fires after). This is important if you are saving information about the player that might be removed or cleaned up on removal.
Properties 32
AccountAge
: intReadOnlyNotReplicatedDescribes the player's account age in days.This property describes how long ago a player's account was registered in days. It is set using the
SetAccountAge()method, which cannot be accessed by scripts.AgeChecked
: AgeCheckStatusIndicates whether the player has completed an age verification check.This read-only property holds an
AgeCheckStatusvalue indicating whether the player has completed age verification. The default value isAgeCheckStatus.Unchecked. It transitions toAgeCheckStatus.Checkedwhen the player passes age verification through thePlayer.PromptAgeCheckflow.This property is set by the server and cannot be changed by scripts.
AutoJumpEnabled
: booleanDetermines whether the character of a player using a mobile device will automatically jump upon hitting an obstacle.This property determines whether the
Characterof aPlayerusing a mobile device will automatically jump when they hit an obstacle. This can make levels more navigable while on a mobile device.When the player joins the experience, the
StarterPlayer.AutoJumpEnabledvalue determines the initial state of this property. Then, this property determines the value of theHumanoid.AutoJumpEnabledproperty of theCharacteron spawn. In other words, it is possible to set the auto-jump behavior on a per-character, per-player, and per-experience basis using these three properties.CameraMaxZoomDistance
: floatThe maximum distance the player's camera is allowed to zoom out.This property sets the maximum distance the player's camera is allowed to zoom out, in studs.
The default value of this property is set by
StarterPlayer.CameraMaxZoomDistance. If this value is set to a lower value thanCameraMinZoomDistance, it will be increased toCameraMinZoomDistance.CameraMinZoomDistance
: floatThe minimum distance the player's camera is allowed to zoom in.This property sets the minimum distance the player's camera is allowed to zoom in, in studs.
The default value of this property is set by
StarterPlayer.CameraMinZoomDistance. If this value is set to a higher value thanCameraMaxZoomDistance, it will be decreased toCameraMaxZoomDistance.CameraMode
: CameraModeChanges the camera's mode to either first or third person.This property sets the player's camera mode, defaulting to third person.
Third Person
In the default third person mode (
CameraMode.Classic), the character can be seen in the camera. While in this mode, the default behavior is:- Players can right-click and drag (mouse), tap and drag (mobile), use the secondary thumbstick (gamepad), or press the left/right arrows (keyboard) to rotate the camera around their character.
- When a player moves their character, it faces in the corresponding movement direction.
- Players can zoom in and out freely, even to first person on full zoom in.
First Person
In first person mode (
CameraMode.LockFirstPerson), the player's camera is zoomed all the way in. Unless there is a visible GUI present with theGuiButton.Modalproperty set totrue, moving the mouse, tap-dragging on mobile, or using the secondary thumbstick on a gamepad will rotate the camera around the character.CanLoadCharacterAppearance
: booleanDetermines whether the character's appearance will be loaded when the player spawns. Iffalse, the player will spawn with a default appearance.This property determines whether the character's appearance will be loaded when the player spawns. The default value of this property is set by
StarterPlayer.LoadPlayerAppearance.If
true, the character will load the appearance of the player corresponding to the player'sCharacterAppearanceId.If
false, the player will spawn with a default appearance.
Attempting to set the property after the character has spawned will not change the character; you must call
LoadCharacterAsync()to load the new appearance.Character
: ModelAModelcontrolled by the player that contains aHumanoid, body parts, scripts, and other objects.This property contains a reference to a
Modelcontaining aHumanoid, body parts, scripts, and other objects required for simulating the player's avatar in-experience. The model is parented to theWorkspacebut it may be moved. It is automatically loaded whenPlayers.CharacterAutoLoadsistrueand it can be manually loaded otherwise usingLoadCharacterAsync().Initially this property is
niland it is set when the player's character first spawns. Use theCharacterAddedevent to detect when a player's character properly loads, and theCharacterRemovingevent to detect when the character is about to despawn. Avoid usingObject.GetPropertyChangedSignalon this property.Note that
LocalScriptsthat are cloned fromStarterGuiorStarterPackinto a player'sPlayerGuiorBackpackrespectively are often run before the old character model is replaced, soPlayer.Charactermay refer to the old model whoseParentproperty isnil. Therefore, in aLocalScriptunderStarterGuiorStarterPack, it is advisable to make sure the parent ofCharacteris notnilbefore using it, for example:CharacterAppearanceId
: int64Determines the user ID of the account whose character appearance is used for a player'sCharacter.This property determines the user ID of the account whose character appearance is used for a player's
Character. By default, this property is theUserId, which uses the player's avatar as they have created it on Roblox.Changing this property to the user ID of another account will cause the player to spawn with that account's appearance.
You can also toggle whether or not a player's character appearance is loaded in experience by changing the
StarterPlayer.LoadCharacterAppearanceproperty.DevCameraOcclusionMode
: DevCameraOcclusionModeSets how the default camera handles objects between the camera and the player.Defines how the default camera scripts handle objects between the camera and the camera subject. Set by
StarterPlayer.DevCameraOcclusionModeand can't be changed for individual players.The default value is
Zoom. SeeDevCameraOcclusionModefor a list of available modes.DevComputerCameraMode
: DevComputerCameraMovementModeDetermines player's camera movement mode when using a device with a mouse and keyboard.This property determines the manner in which a player moves their camera when using a device with a mouse and keyboard. This property cannot be set using a
LocalScript(it must be set on the server using aScript).The default value of this property is determined by
StarterPlayer.DevComputerCameraMovementMode.This property doesn't affect players using a
TouchEnableddevice. SeeDevTouchCameraModeinstead.DevComputerMovementMode
: DevComputerMovementModeDetermines player's character movement mode when using a device with a mouse and keyboard.This property determines the manner in which a player moves their character when using a device with a mouse and keyboard. This property cannot be set using a
LocalScript(it must be set on the server using aScript).The default value of this property is determined by
StarterPlayer.DevComputerMovementMode.This property doesn't affect players using a
TouchEnableddevice. SeeDevTouchMovementModeinstead.DevEnableMouseLock
: booleanDetermines if the player can toggle mouse lock.This property determines if a player is able to toggle mouse lock by pressing Shift. A player can disable the mouse lock switch in the experience's settings during play. By default, this property is set to the value of
StarterPlayer.EnableMouseLockOption. This can be set server-side during runtime by using aScript. It can not be set client-side.When mouse lock is enabled, the player's cursor is locked to the center of the screen. Moving the mouse will orbit the camera around the player's
Character, and the character will face the same direction as theCamera. It also offsets the camera view just over the right shoulder of the player's character.DevTouchCameraMode
: DevTouchCameraMovementModeDetermines player's camera movement mode when using a touch-enabled device.This property determines the manner in which a player moves their camera when using a
TouchEnableddevice. This property cannot be set using aLocalScript(it must be set on the server using aScript).The default value of this property is determined by
StarterPlayer.DevTouchCameraMovementMode.This property doesn't affect players who aren't using a
TouchEnableddevice. SeeDevComputerCameraModeinstead.DevTouchMovementMode
: DevTouchMovementModeDetermines player's character movement mode when using a touch-enabled device.This property determines the manner in which a player moves their character when using a
TouchEnableddevice. This property cannot be set using aLocalScript(it must be set on the server using aScript).The default value of this property is determined by
StarterPlayer.DevTouchMovementMode.This property doesn't affect players who aren't using a
TouchEnableddevice. SeeDevComputerMovementModeinstead.DisplayName
: stringThe display name of the authenticated user associated with thePlayer.This property contains the display name of the authenticated user associated with the
Playerobject. UnlikeUserId, display names are non-unique names a player displays to others.Usage Notes
Since display names are non-unique, it's possible for two players in a single instance to have identical names. If you need a globally unique identifier for a player, use
UserIdinstead.Characters generated with
LoadCharacterAsync()or by the Roblox engine will have theirHumanoid.DisplayNameproperty assigned to thePlayer.DisplayNameproperty.Display names may have unicode characters in the string. See
UTF-8for more information on how to work with strings with unicode characters.
FollowUserId
: int64ReadOnlyNotReplicatedDescribes the user ID of the player who was followed into an experience by a player.This property contains the
UserIdof the user that a player followed into the experience, or0if the player did not follow anyone in. This property is useful for alerting players who have been followed by another player into the experience.You can get the name of the player followed using this user ID and the
Players.GetNameFromUserIdAsyncmethod.FrustumStreaming
: FrustumStreamingModeControls the engine's instance streaming behavior for the player's camera view.This property controls the engine's instance streaming behavior for the camera view of the given player.
Enabledmeans the player will always stream their camera view.Automaticmeans the engine will decide to stream the camera view based on the player's capability (based on the bandwidth, device memory, etc.) and gameplay suitability.Disabledmeans the player will never stream their camera view.Defaultcurrently behaves the same asDisabled.GameplayPaused
: booleanHiddenWhether player client-side gameplay is currently paused.This property indicates if the player is currently in a pause state in a place with
StreamingEnabledactivated. It is set on the client but replicated to the server.See Also
Workspace.StreamingEnabledwhich controls whether content streaming is enabledWorkspace.StreamingIntegrityModeandStreamingIntegrityModefor more details on when gameplay is paused.
HasRobloxSubscription
: booleanIndicates whether the player has an active Roblox subscription.This read-only property is
truewhen the player has an active Roblox subscription (the flagship Roblox membership), andfalseotherwise. It is set by the server and cannot be changed by scripts.Use this property instead of
Player.MembershipTypeto check for the Roblox subscription.HasVerifiedBadge
: booleanIndicates if a player has a Verified badge.This property indicates if the player has a Verified badge.
HealthDisplayDistance
: floatSets the distance at which this player will see other players' health bars.This property sets the distance in studs at which this player will see other
Humanoidhealth bars. If set to0, the health bars will not be displayed. This property is set toStarterPlayer.HealthDisplayDistanceby default.If a humanoid's health bar is visible, you can set the display type using
Humanoid.DisplayDistanceType.LocaleId
: stringHiddenReadOnlyNotReplicatedThis property shows the locale ID that the local player has set for their Roblox account.This property shows the locale ID that the local player has set for their Roblox account. It holds a string with the two letter code, for example
en-us.See also
LocalizationService.RobloxLocaleId, the locale ID used for localizing internal content. This can be a different value when the player's account locale isn't supported for internal content localization.NameDisplayDistance
: floatSets the distance at which this player will see other players' names.This property sets the distance in studs at which this player will see other
Humanoidnames. If the property is set to0, names are hidden. This property is set toStarterPlayer.NameDisplayDistanceby default.If a humanoid's name is visible, you can set the display type using
Humanoid.DisplayDistanceType.Neutral
: booleanDetermines whether the player is on a specific team.This property determines whether the player is on a specific team.
PartyId
: stringHiddenNotReplicatedA unique identifier of the party aPlayerbelongs to.A read-only string identifying the party the player currently belongs to within the experience. If the player is not in a party, this value is an empty string.
This property is essential for integrating with the Roblox Party feature. Use it in combination with
SocialService.GetPlayersByPartyIdandSocialService.GetPartyAsyncto access information about a player's party and its members.To test this service in your experience, use the Party Simulator in Roblox Studio or publish the experience and play it in the Roblox application.
ReplicationFocus
: InstanceSets the part to focus replication around.This property sets the part to focus replication around a player. Different Roblox systems that communicate over the network (such as physics, streaming, etc.) replicate at different rates depending on how close objects are to the replication focus.
When this property is
nil, it reverts to its default behavior which is to treat the local player's character'sPrimaryPartas the replication focus.This property should only be set on the server with a
Script, not aLocalScript. Note that this property does not change or update network ownership of parts.RespawnLocation
: SpawnLocationIf set, the player will respawn at the givenSpawnLocation.If set, the player will respawn at the given
SpawnLocationwhich must meet the following criteria:Descendant of
Workspace.The
SpawnLocation.TeamColorproperty is set to the player'sTeamColoror theSpawnLocation.Neutralproperty is set totrue.
Alternatives
- A
Playerwill spawn fromSpawnLocationsbelonging to their team. In some cases it may be simpler to change the player'sTeaminstead. - Implement your own custom spawn logic using
PVInstance.PivotToto manually move theCharacter.
Team
: TeamNotReplicatedDetermines theTeamwith which the player is associated.This property is a reference to a
Teamobject within theTeamsservice. If the player isn't on a team or has an invalidTeamColor, this property isnil. When this property is set, the player has joined theTeamand theTeam.PlayerAddedevent fires on the associated team. Similarly,Team.PlayerRemovedfires when the property is unset from a certainTeam.TeamColor
: BrickColorDetermines theTeamwith which the player is associated with according to that team'sTeam.TeamColor.This property determines which
Teama player is associated with according to that team'sTeam.TeamColor. If noTeamobject has the associatedBrickColor, the player will not be associated with a team.It's often a better idea to set
Player.Teamto the respectiveTeaminstead of using this property. Setting this property often leads to repetition of the sameBrickColorvalue for a certain team across many scripts.User
: UserTheUserrepresenting this player's domain-scoped identity within the current experience.A read-only
Uservalue that represents this player's domain-scoped identity within the current experience. TheUserencapsulates the player's domain user ID alongside the domain type and domain ID, providing an unambiguous identifier that carries its context.Use this property as the standard way to identify users in new code. Engine APIs that accept user ID parameters also accept
Uservalues directly.UserId
: int64A unique identifying integer assigned to all user accounts.This property contains a read-only integer that uniquely and consistently identifies the user's account on Roblox. Unlike the player's
DisplayNamewhich may change, this value will never change for the same account.This property is essential when saving/loading player data using
GlobalDataStores.
Methods 23
AddReplicationFocus
(part: BasePart) → ()Adds an additional replication focus for the player.This method adds an additional replication focus for the player in order to trigger streaming around the location of the specified
part. In this manner, streaming can occur around multiple locations, not just the location ofPlayer.ReplicationFocus. This has no effect in experiences that are not streaming enabled.Additional foci will use the same values of
Workspace.StreamingMinRadiusandWorkspace.StreamingTargetRadiusas are used by the primary focus.This method should only be called on the server. It has no effect when called from a
LocalScript.ClearCachedAvatarAppearance
() → ()Clears the cached avatar appearance for the player, forcing a fresh fetch from the backend on the next respawn.This method clears the cached avatar appearance for the player. The next time
LoadCharacterAsync()is called with the player's default platform appearance, a fresh version will be fetched from the backend instead of using the cached version.Avatar appearance is cached after the first load to improve respawn latency and reduce backend load; most players do not change their avatar mid-session. Call this method when you want to reflect a change the player has made to their avatar outside of the experience, for example to implement a custom refresh button that mirrors the behavior of the default in-experience menu.
ClearCharacterAppearance
() → ()Removes all accessories and other character appearance objects from a player'sCharacter.This method removes all
Accessory,Shirt,Pants,CharacterMesh, andBodyColorsfrom the given player'sCharacter. In addition, it also removes the T-ShirtDecalon the player's torso. The character's body part colors and face will remain unchanged. This method does nothing if the player does not have aCharacter.DistanceFromCharacter
(point: Vector3) → floatReturns the distance between the character's head and the givenVector3, or0if the player has no character.This method returns the distance between the character's head and the given
Vector3point, or0if the player has noCharacter.This is useful when determining the distance between a player and another object or location in experience.
If you would like to determine the distance between two non-player instances or positions, you can use the following:
GetCameraState
() → CameraStateReturns a dictionary containing the player's current camera state.Returns a dictionary containing information about the player's current camera state. This method requires Server Authority to be enabled in the game. The dictionary contains the following fields:
On the client, this method can only be called on the
Players.LocalPlayer. On the server, it can be called on anyPlayerobject to retrieve their replicated camera state. Typical server-side uses include aim and look-direction logic in server-authoritative gameplay, and camera-aware content streaming.The
CFramefield is replicated as part of the player's input stream, meaning it is synchronized with other inputs such as movement and actions. TheFieldOfViewandViewportSizefields use standard client-to-server property replication which is not synchronized with input and may update at a different cadence.GetFriendsOnlineAsync
(maxFriends: int = 200) → ArrayYieldsReturns a dictionary of online friends.This function returns a dictionary array of online friends, using a 30 second cache. In the returned array, some fields are only present for certain location types; for example,
PlaceIdwon't be present whenLocationTypeis0(mobile website).GetFriendsWhoPlayedAsync
() → ArrayYieldsReturns the user IDs of friends who have previously joined this experience.Returns an array of user IDs of any friends who have previously played this game. For example, if a player has had two friends play the game, the method might return
{1111111111, 2222222222}. If no friends have played this game, the method returns an empty array ({}).This is particularly useful for friend leaderboards: by narrowing DataStore lookups to only friends who have actually played the experience, you avoid fetching scores for the entire friends list and reduce the risk of hitting DataStore rate limits.
GetJoinData
() → DictionaryReturns a dictionary containing information describing how the player joins the experience.Returns a dictionary containing information describing how the player joins the experience. The dictionary contains any of the following fields:
If a server initiates the player's teleport, the dictionary that this method returns includes the player's teleport data. The
GetJoinData()method can only be used to fetch teleport data on the server. To fetch the data on the client, useTeleportService.GetLocalPlayerTeleportData.Unlike
TeleportService.GetLocalPlayerTeleportData,GetJoinData()only provides teleport data that meets the following security criteria:- It's guaranteed to have been sent by a Roblox server in the past 48 hours.
- It's guaranteed to have been sent with this
Player. - The
SourcePlaceIdandSourceGameIdare guaranteed to be the place and universe the data was sent from. This means you can verify the teleport data came from an approved place.
As this data is transmitted by the client, it can still potentially be abused by an exploiter. Sensitive data such as player currency should be transmitted via a secure solution like Memory Stores.
GetMouse
() → MouseReturns the mouse being used by the client.This method returns the
Mousebeing used by the client. The player's mouse instance can be used to track user mouse input including left and right mouse button clicks and movement and location.Note that
UserInputServiceprovides additional methods, properties, and events to track user input, especially for devices that do not use a mouse.GetNetworkPing
() → floatReturns the round-trip, isolated network latency in seconds.Returns the round-trip, isolated network latency of the player in seconds. "Ping" is a measurement of the time taken for data to be sent from the client to the server, then back again. It doesn't involve data deserialization or processing.
For client-side
LocalScripts, this function can only be called on thePlayers.LocalPlayer. This function is useful in identifying and debugging issues that occur in high network latency scenarios. It's also useful for masking latency, such as adjusting the speed of throwing animations for projectiles.HasAppearanceLoaded
() → booleanReturns whether or not the appearance of the player's character has loaded.This method returns whether or not the appearance of the player's
Characterhas loaded. Appearance includes items such as the player'sShirt,Pants, andAccessories.This is useful when determining whether a player's appearance has loaded after they first join the experience, which can be tracked using the
Players.PlayerAddedevent.IsFriendsWithAsync
(userId: User) → booleanYieldsChecks whether a player is a friend of the user with the givenPlayer.UserId.This method sends a request to Roblox asking whether a player is a friend of another user, given the
UserIdof that user. This method caches results so multiple calls on the same player with the sameuserIdmay not yield the most up-to-date result.IsInGroupAsync
(groupId: int64) → booleanYieldsChecks whether a player is a member of a group with the given ID.This method sends a request to Roblox asking whether a player is a member of a group, given the ID of that group.
This call may not yield the most up-to-date information. If a player leaves a group while they are in the experience,
IsInGroupAsync()will still think they're in that group until they leave. However, this does not happen when used with aLocalScriptbecause the method caches results, so multiple calls ofIsInGroupAsync()on the same player with the same group ID will yield the same result as when the method was first called with the given group ID. The caching behavior is on a per-peer basis: a server does not share the same cache as a client.When a player joins a group in-experience due to a call to
GroupService.PromptJoinAsync, any cached value for that player will be cleared on the client where the prompt was shown.IsVerified
(level: VerifiedLevel = Low) → booleanReturns whether the player meets the specified verification level.Returns a boolean value indicating whether the player meets the specified
VerifiedLevel. Whenlevelis omitted, this method defaults toVerifiedLevel.Low. Note that this is a distinct check from the verified badge.Verification uses concrete, real-world signals, including, but not limited to, phone number or government ID verification.
When implementing
IsVerified, exercise caution to ensure that the implementation does not inadvertently block all unverified users.Note that the method can only be called on the backend server. Calling it client-side results in an error. Additionally, this method will always return
falsein Studio.Kick
(message: string) → ()Forcibly disconnect a player from the experience, optionally providing a message.This method allows an experience to gracefully disconnect a client and optionally provide a message to the disconnected user. This is useful for moderating abusive users. You should only allow specific users whom you trust to trigger this method on other users.
Calling this method on a
Playerwith no arguments disconnects the user from the server and provides a default notice message. Calling this method on aPlayeralong with a string as the first argument replaces the default message with the provided string.When using this method from a
LocalScript, only the local user's client can be kicked.LoadCharacterAsync
() → ()YieldsCreates a new character for the player, removing the old one. Also clears the player'sBackpackandPlayerGui.This method creates a new character for the player, removing the old one. It also clears the player's
BackpackandPlayerGui. This is useful in cases where you want to reload the character without killing the player, such as when you want to load a new character appearance after changing the player'sCharacterAppearance.When reloading a
Playerwith their default platform appearance applied, a cached version of their appearance will be loaded. The cached version is cleared whenever the player's appearance is updated usingAvatarEditorServiceor when the player manually resets via the in-experience menu. To programmatically clear this cache, callClearCachedAvatarAppearance()before callingLoadCharacterAsync().After calling
LoadCharacterAsync()for an individual player, it is not recommended to call it again for the same player until after that player'sCharacterAppearanceLoadedevent has fired.Character Loading Event Order
Calling the
LoadCharacterAsync()method on anyPlayerfires events in the following order:Player.Charactersets, automatically removing old character.Player.CharacterAddedfires.Object.Changedfires on thePlayerwith a value ofCharacter.- The character appearance initializes.
Player.CharacterAppearanceLoadedfires.- The character's
Parentsets to theDataModel. - The character rig builds and scales.
- The character moves to the spawn location.
LoadCharacterWithHumanoidDescriptionAsync
(humanoidDescription: HumanoidDescription, assetTypeVerification: AssetTypeVerification = Default) → ()YieldsSpawns a player character with everything equipped in the passed inHumanoidDescription.This method spawns a player character with everything equipped in the passed in
HumanoidDescription.After calling this method for an individual player, it is not recommended to call it again for the same player until after that player's
CharacterAppearanceLoadedevent has fired.See also HumanoidDescription System, an article which explains the humanoid description system in greater detail and provides several scripting examples.
Move
(walkDirection: Vector3, relativeToCamera: boolean = false) → ()Causes the player's character to walk in the given direction until stopped, or interrupted by the player (by using their controls).This method causes the player's character to walk in the given direction until stopped, or interrupted by the player (by using their controls).
This is useful when scripting NPC
Humanoidsthat move around a map but are not controlled by an actual player's input.Note that the function's second argument indicates whether the provided
Vector3should move the player relative to world coordinates (false) or the player'sCamera(true).PromptAgeCheck
() → ()Prompts the player to complete age verification.This method requests that the player be shown the age verification prompt. When called from a
LocalScript, it must target thePlayers.LocalPlayer; when called from a serverScript, it can target anyPlayer. Repeated calls for the same player within a short cooldown window are silently ignored.On success, the
PromptAgeCheckRequestedevent fires on the target player's client. When the player passes verification, theirPlayer.AgeCheckedproperty transitions toAgeCheckStatus.Checked.RemoveReplicationFocus
(part: BasePart) → ()Removes a previously added replication focus.This method removes a replication focus previously added by
AddReplicationFocus(). Has no effect in experiences that are not streaming enabled.This method should only be called on the server. It has no effect when called from a
LocalScript.RequestStreamAroundAsync
(position: Vector3, timeOut: double = 0) → ()YieldsRequests that the server stream to the player around the specified location.For experiences where instance streaming is enabled, requests that the server stream to the player regions (parts and terrain) around the specified X, Y, Z location in the 3D world. It is useful if the experience knows that the player's
CFramewill be set to the specified location in the near future. Without providing the location with this call, the player may not have streamed in content for the destination, resulting in a streaming pause or other undesirable behavior.The effect of this call will be temporary and there are no guarantees of what will be streamed in around the specified location. Client memory limits and network conditions may impact what will be available on the client.
SetAccountAge
(accountAge: int) → ()PluginSets theAccountAgeof the player.This method sets the
AccountAgeof the player in days, meaning the age of the account itself relative to when it was first created.SetSuperSafeChat
(value: boolean) → ()PluginSets whether or not the player sees filtered chats, rather than normal chats.This method sets whether or not the player sees chat filtered by
TextService.FilterStringAsyncrather than normal chats.local Players = game:GetService("Players") local player = Players.LocalPlayer player:SetSuperSafeChat(true)Regardless of whether a player has filtered chat enabled, all chat should be filtered by
TextServicewhen broadcast to other players or on the player's own screen.TextService.FilterStringAsyncreturns aTextFilterResultobject that can be filtered differently according to the message's intended use.
Events 6
CharacterAdded
Player.CharacterAdded:Connect(function(character))Fires when a player's character spawns or respawns.This event fires when a player's character spawns or respawns. It fires soon after setting
Characterto a non-nilvalue or callingLoadCharacterAsync(), which is before the character is parented to theWorkspace.This can be used alongside the
CharacterRemovingevent which fires right before a player's character is about to be removed, typically after death. As such, both of these events can potentially fire many times as players die then respawn in a place.Note that the
Humanoidand its default body parts (head, torso, and limbs) will exist on the server when this event fires, but clothing items likeHats,Shirts, andPantsmight take a few seconds to be added to the character. The parts will also take time to replicate to clients. ConnectInstance.ChildAddedon the added character to detect these, or wait for theCharacterAppearanceLoadedevent to be sure the character has everything equipped.If you instead need to track when a player joins/leaves the experience, use the events
Players.PlayerAddedandPlayers.PlayerRemoving.CharacterAppearanceLoaded
Player.CharacterAppearanceLoaded:Connect(function(character))Fires when the full appearance of aCharacterhas been inserted.This event fires when the full appearance of a
Characterhas been inserted. It only fires on the server.A
Charactergenerally has a range of objects modifying its appearance, includingAccoutrements,Shirts,PantsandCharacterMeshes. This event will fire when all such objects have been inserted into the character.For custom character implementations, such as using a character model named
StarterCharacterinsideStarterPlayer, useCharacterAddedand handle your own accessories.One use for this event is to ensure all accessories have loaded before destroying them. See below for an example of this.
CharacterRemoving
Player.CharacterRemoving:Connect(function(character))Fires right before a player's character is removed.This event fires right before a player's
Characteris removed, such as when the player is respawning. This can be used alongside theCharacterAddedevent which fires when a player's character spawns or respawns.If you instead need to track when a player joins/leaves the experience, use the events
Players.PlayerAddedandPlayers.PlayerRemoving.Chatted
Player.Chatted:Connect(function(message, recipient))Fires when a player chats in experience using Roblox's provided chat bar.This event fires when a
Playertypes a message and presses Enter in Roblox's provided chat bar. This is done using some Luau bindings by the default chat script. You can prevent players from chatting by usingStarterGui.SetCoreGuiEnabledand settingCoreGuiType.Chattofalse.Idled
Player.Idled:Connect(function(time))This event fires approximately two minutes after the engine classifies the player as idle. Time is the number of seconds that have elapsed since that point.This event fires approximately two minutes after the engine classifies the player as idle. Time is the number of seconds that have elapsed since that point. The event continues to fire every 30 seconds for as long as the player remains idle.
Once the player becomes active again,
Idledstops firing and the elapsed idle time resets. There is no separate event for the transition back to activity. If the player goes idle again later,Idledwaits the same ~2 minutes before firing again.This event only fires in client scripts, not server scripts; use a
RemoteEventto notify the server of idle players.Roblox automatically disconnects players that have been idle for at least 20 minutes, so this event is useful for warning players that they will be disconnected soon, disconnecting players prior to those 20 minutes, or other away from keyboard (AFK) features.
To track how often automatic disconnects occur, try correlating this event with occurrences of
Players.PlayerRemoving.OnTeleport
Player.OnTeleport:Connect(function(teleportState, placeId, spawnName))Fires when the teleport state of a player changes.This event fires when the
TeleportStateof a player changes. This event is useful for detecting whether a teleportation was successful.
Player also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.