Represents an in-game character, providing properties and methods to control its movement, appearance, and interaction within the game environment.
Properties
Event that fires when the characters anchor changes
Event fired when an animation event occurs
local player = client.localPlayer
player.character.AnimationEvent:Connect(function(event)
  print("Animation event: " .. event)
end)
Event that fires when the character plays an emote
Event that fires when the character stops an emote in progress or a looping emote
Event fired when the character has finished moving
local player = client.localPlayer
player.character.MoveFinished:Connect(function()
  print("Character has finished moving.")
end)
Event fired when the character has started moving
Event that fires when the outfit of a character changes
Event fired when the characters state changes
local player = client.localPlayer
player.character.StateChanged:Connect(function(state)
  print("Character state changed to " .. state)
end)
Return the character's current anchor
Returns the transform for chat bubbles.
Returns the collection of default outfits for the character
Return the destination point of the current move
local player = client.localPlayer
print(tostring(player.character.destination))
Return the distance to the destination if character is moving or 0
local player = client.localPlayer
print(tostring(player.character.distanceToDestination))
Returns true if the character has one or more outfits
Returns true if the character is currently anchored
Returns true if the character is in a moving state (Walking, Running, or Jumping). A character attached to an anchor is considered to be in an idle state, even if the anchor is set to play a walk or run animation.
local player = client.localPlayer
print(tostring(player.character.isMoving))
Get/Set the distance at which the character will choose to jog instead of walk
Get/Set the characters jog speed
Get/Set the characters run speed
Return the outfits assigned to this character
Returns the player that is controlling this character if the character is the player character, otherwise null
The rendering layer of the character for drawing order.
The position of the character in the game world for rendering purposes.
local player = client.localPlayer
player.character.renderPosition = Vector3.New(0, 0, 0)
The rotation of the character in the game world for rendering purposes.
local player = client.localPlayer
player.character.renderRotation = Quaternion.New(0, 0, 0, 1)
The scale of the character in the game world for rendering purposes.
local player = client.localPlayer
player.character.renderScale = Vector3.New(1, 1, 1)
Get/Set the distance at which the character will choose to run instead of walk
Get/Set the characters run speed
The movement speed of the character. You must wait for the player to connect before setting this property.
local player = client.localPlayer
player.character.speed = 10
The current state of the character.
When set to true, the character uses pathfinding to navigate to its destination.
local player = client.localPlayer
player.character.usePathfinding = true
Get/Set the characters walk speed
Methods
Adds an outfit to the character's current appearance.
Parameters
outfit
The outfit asset to add to the character.
Returns
Attaches an object to a Character's bone. You can use the Bones class to get a list of available bones.
Parameters
attachment
Transform that you want to attach to the character.
boneName
Name of the bone to attach the object to.
offsetPosition
After being attached, the object's localPosition will be set to this value.
offsetRotation
After being attached, the object's localRotation will be set to this value.
Returns
Attaches an object to a Character's bone. You can use the Bones class to get a list of available bones.
Parameters
attachment
Transform that you want to attach to the character.
boneName
Name of the bone to attach the object to.
keepCurrentPosition
If true, the attachment will keep its current world position after being attached.
keepCurrentRotation
If true, the attachment will keep its current world rotation after being attached.
Returns
Copy the outfit from the given character replacing the default outfit and any additional outfits
Parameters
character
Returns
Detaches an object that has been attached to this character.
Parameters
attachment
Transform that you want to detach.
Returns
Parameters
Returns
Parameters
Returns
Play a single character animation using a character animation asset
Parameters
anim
Returns
Jump from the current position to the given position
Parameters
position
Returns
Jump from the current position to the given position
Parameters
Returns
Parameters
path
Returns
Move the avatar to a position
local player = client.localPlayer
player.character:MoveTo(Vector3.New(0, 0, 0))
Parameters
position
The target position for the character to move to.
areaMask
An optional mask to specify allowed movement areas.
targetSearchDistance
The target search distance for the character to move to.
Returns
True if movement is successfully initiated.
Parameters
Returns
Move the character within a certain distance of a position
local player = client.localPlayer
player.character:MoveWithinRangeOf(Vector3.New(0, 0, 0), 5)
Parameters
destination
The target position for the character to move to.
stopDistance
The distance to stop at.
areaMask
An optional mask to specify allowed movement areas.
targetSearchDistance
The target search distance for the character to move to.
Returns
True if movement is successfully initiated.
Play a single character animation using a character animation asset
Parameters
Returns
Play a single character animation using a character animation asset
Plays a specified emote animation on the character.
local player = client.localPlayer
player.character:PlayEmote("idle-dance-casual", 1.0, false, function()
print("Emote playback complete.")
end)
Plays a specified emote animation on the character.
local player = client.localPlayer
player.character:PlayEmote("idle-dance-casual", 1.0, false, function()
print("Emote playback complete.")
end)
Returns
Remove an outfit from the character
Parameters
outfit
The outfit asset to remove from the character.
Returns
Reset the outfit back to the default state, for player characters this means their chosen outfit and for npcs this means the outfit they were created with.
Returns
Set the character into an idle state.
local player = client.localPlayer
player.character:SetIdle()
Returns
Set the outfit for the character by removing all existing outfits and replacing with the new outfit
Parameters
outfit
The outfit asset to apply to the character.
Returns
Stop a looping emote that is playing
Returns
Teleport the character to the given position
local player = client.localPlayer
player.character:Teleport(Vector3.New(0, 0, 0))
Parameters
position
The target position for the character to teleport to.
Returns
True if teleport is successfully initiated.
Teleport the character to an anchor from wherever they are
Parameters
anchor
Returns
Returns
Smoothly transitions the character's render position from one point to another.
local player = client.localPlayer
player.character:TweenRenderPosition(Vector3.New(0, 0, 0), Vector3.New(10, 0, 0))
Initiates a smooth transition for the character's render position to a specified destination.
local player = client.localPlayer
player.character:TweenRenderPositionTo(Vector3.New(10, 0, 0))
Updated 12 days ago