Skip to content

Character

A Character is a type of Entity which provides additional features for a humanoid character model in the game. A Character can be controlled by a User. To get one from a User do user:GetPlayer(). Character derives from Entity so if you have a Character you can do any of these functions as well as the functions in Entity. You can do entity:IsA(Character) to see if a particular entity variable is a Character type entity.

Functions

Function Name Usage Description Notes
Attach characterToAttachTo:Attach(Entity entityToAttach, string socketName) Attach an entity to this character using the given socketName (this is deprecated and will be removed, do entity:AttachTo(characterToAttachTo, socketName)) Deprecated, Server Only
GetUser User character:GetUser() Get the User entity which controls this Character
SetAlive character:SetAlive(bool alive) For a Player set it to be alive (true) or dead (false). Server Only
IsAlive bool character:IsAlive() Get whether a Player is alive. Return false for non-Player.
GetLookAtPos Vector character:GetLookAtPos() Get the point the player is looking at, for an action camera this is the same as User:GetCameraLookAtPos but
for orbit style cameras it will be in front of the player Server Only, Local Only
GetLookAt Vector,Vector character:GetLookAt() Return two values, the position of the player's virtual "eye" and the position the player is looking at.
For an action camera this is the same as User:GetCameraLookAt but for an orbit style camera it will be the
player's head position and what is in front of the player. Server Only, Local Only
SetInputLocked character:SetInputLocked(bool inputLocked) Lock player control Server Only, Local Only
SetGrip character:SetGrip(GripAsset gripPresetAsset) Set the current grip animations used by this player. Passing nil is the same as calling SetNoGrip()
SetNoGrip character:SetNoGrip() Reverts the player back to the default 'unarmed' animations. Can also be achieved by calling SetGrip(nil)
PlayAction character:PlayAction(string actionName, table properties) Play an animation action, with properties specifying how it should be played
PlayAction character:PlayAction(string actionName) Play an animation action with default properties
HasAction bool character:HasAction(string actionName) Returns true if the current grip can perform this type of action
GetActions table character:GetActions() Get the name of every available action for this grip type
GetActionEvents table character:GetActionEvents(string actionName) Get the name of every event available event for an action
HasActionEvent bool character:HasActionEvent(string actionName, string eventName) Returns true if this action has an animation event of the specified name
GetPlayLength number character:GetPlayLength(string actionName) Returns the length of an animation, in seconds, assuming a playbackSpeed of 1 is set
Launch character:Launch(Vector impulse) Launch the character
GetInteraction Entity,HitResult character:GetInteraction() Get whichever Entity you would interact with if you pressed interact Server Only, Local Only
PlayVibrationEffect character:PlayVibrationEffect(VibrationEffectAsset vibrationEffect)
PlayManualVibration character:PlayManualVibration(number intensity, number duration, bool affectSmallMotors, bool affectLargeMotors)
AdjustAim AdjustAimHandle character:AdjustAim(... args)
CancelAdjustAim character:CancelAdjustAim(AdjustAimHandle handle)
IsAdjustAimActive bool character:IsAdjustAimActive()

Parameters

Parameter Name Usage Description Notes
speedMultiplier number speedMultiplier Multiplier on movement speed (default is 1.0)
jumpHeightMultiplier number jumpHeightMultiplier Multiplier on jump height (default is 1.0)
canSprint bool canSprint Turn on or off ability to sprint
canRun bool canRun Turn on or off ability to run
canWalk bool canWalk Turn on or off ability to walk
canMantle bool canMantle Turn on or off ability to mantle
maxMantleHeight number maxMantleHeight Set the maximum height that a player can mantle
canSlide bool canSlide Turn on or off ability to slide
canRoll bool canRoll Turn on or off ability to roll
canRelax bool canRelax Turn on or off ability to go into a grip's relaxed pose
breakFall bool breakFall Turn on or off ability to break fall on landing
breakFallSpeed number breakFallSpeed Turn on or off ability to break fall on landing
canJump bool canJump Turn on or off ability to jump
displayDefaultNameTag bool displayDefaultNameTag Turn on or off the default name tag
displayDefaultQuickChat bool displayDefaultQuickChat Turn on or off the default overhead quick chat
canCrouch bool canCrouch Turn on or off ability to crouch or go prone
interactionRange number interactionRange Interaction range (from camera in cm)
cameraType number cameraType Set the character camera type. 1 = Action, 2 = Orbit
forcedCameraPerspective number forcedCameraPerspective Set restrictions on the action player camera perspective. 1 = No Restrictions, 2 = 1st Person Only, 3 = 3rd Person Only. (Default is 1)
canIronSight bool canIronSight Will the action camera iron-sight on secondary press
thirdPersonFOV number thirdPersonFOV FOV of the third person action camera
thirdPersonIronSightFOV number thirdPersonIronSightFOV FOV of the third person action camera in Iron Sight mode
firstPersonFOV number firstPersonFOV FOV of the third person action camera
firstPersonIronSightFOV number firstPersonIronSightFOV FOV of the third person action camera in Iron Sight mode
ironSightLookSpeedMultiplier number ironSightLookSpeedMultiplier Speed multiplier of the look controls in Iron Sight mode
cameraDistance number cameraDistance Set the orbit camera max distance from the character
cameraPitch number cameraPitch Set the orbit camera's pitch
cameraYaw number cameraYaw Set the orbit camera's yaw
cameraLock bool cameraLock Lock/Unlock the orbit camera
cameraSecondaryAction number cameraSecondaryAction Set what the secondary action does in the orbit camera
cameraCollisionEnabled bool cameraCollisionEnabled Enable/Disable the camera's collision
damageEnabled bool damageEnabled Turn on or off damage (ie calling of entry point OnDamaged).

Overrides

Override Name Usage Description Notes
new_index character.var = object value