Skip to main content

Character

Character-related APIs. To use these, you must first have a reference to a character, such as the local player's character. Example:

local character = Players.Local()
local localChar = playerClient:GetCharacter()

Player Class Hierarchy

The diagram shows the inheritance hierarchy of player-related classes. To navigate between classes:

  • Get a PlayerClient using Players.Local()
  • Get the NetPlayer from a PlayerClient using :GetNetPlayer()
  • Get the Player from a NetPlayer using :GetGamePlayer()
  • Get the Character from a Player using :GetCharacter()

Class Instance Methods

Inherited Methods

From GameObject:

GameObject:GetPosition(): vec3

Returns the position of the game object.

GameObject:GetRotation(): quat

Returns the rotation of the game object.

GameObject:GetEulerRotation(): vec3

Returns the euler rotation of the game object.

From Damageable:

Damageable:GetHP(): number

Returns the health of the damageable.

Class Methods

Character:SetPosition(pos: vec3)

Sets the Character's position in the world. Do not use this to teleport the local character; use Local.Teleport(pos) instead.

Character:SetLinearVelocity(velocity: vec3)

Sets the Character's linear velocity.

Character:GoRagdoll()

Forces the Character into the ragdoll state.

Character:IsRagdolling(): boolean

Returns true if the Character is currently ragdolling, false otherwise.

Character:IsGettingUpFromRagdoll(): boolean

Returns true if the Character is currently getting up from ragdoll, false otherwise.

Character:UsingParachute(): boolean

Returns true if the Character is using a parachute, false otherwise.

Character:UsingWingsuit(): boolean

Returns true if the Character is using a wingsuit, false otherwise.

Character:GetPlayer(): Player

Returns the Player associated with this Character.

Character:GetBonePosition(bone: Bone): vec3

Gets the world position of a specific bone on a character.

Character:SetGhostMode(enabled: bool)

Enables or disables ghost mode. When ghost mode is enabled, all collisions will be disabled for the character, allowing them to pass through entities, objects, and terrain.

Character:SetCloaked(enabled: bool)

Enables or disables cloaked mode. When cloaked mode is enabled, the character will become mostly invisible with a shine on them.

Character:SetOpacity(opacity: number)

Sets the opacity of the character. Takes a value from 0-1 where 0 means invisible and 1 means fully opaque.