Players are Entities that represents the individual behind the mouse and keyboard. Players are spawned automatically when connected to the server.
👪Inheritance
This class shares methods and events from
Base Entity.
🧑💻API Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our
GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!
🟥 You cannot spawn or Destroy Players.
🎒 Examples
Player.Subscribe("Spawn", function(player)
local new_char = Character(Vector(), Rotator(), "nanos-world::SK_Male")
player:Possess(new_char)
end)
Player.Subscribe("Destroy", function(player)
local character = player:GetControlledCharacter()
if (character) then
character:Destroy()
end
end)
🗿 Static Functions
Inherited Entity Static Functions

GetBySteamID
Retrieves a player by their Steam ID
local player = Player.GetBySteamID(steam_id)
Parameters
| Type | Parameter | Default | Description |
|---|
| string | steam_id | Required parameter | No description provided |
🦠 Functions
Inherited Entity Functions

AttachCameraTo
Attaches the Player`s Camera to an Actor
my_player:AttachCameraTo(actor, socket_offset?, blend_speed?)
Parameters
| Type | Parameter | Default | Description |
|---|
| Base Actor | actor | Required parameter | No description provided |
| Vector | socket_offset? | Vector(0, 0, 0) | No description provided |
| float | blend_speed? | 0.0 | No description provided |

Ban
Bans the player from the server
Parameters
| Type | Parameter | Default | Description |
|---|
| string | reason | Required parameter | No description provided |

Connect
Redirects the player to another server
my_player:Connect(IP, password?)
Parameters
| Type | Parameter | Default | Description |
|---|
| string | IP | Required parameter | No description provided |
| string | password? | | Senha do servidor |

GetAccountIconURL
Return a URL which can be used through WebUI and Widgets to display the Player's Steam Avatar (64x64)
local account_icon_url = my_player:GetAccountIconURL()
Returns
| Type | Description |
|---|
| string | account_icon_url |

GetAccountID
local account_id = my_player:GetAccountID()
Returns
| Type | Description |
|---|
| string | account_id |

GetAccountName
local account_name = my_player:GetAccountName()
Returns
| Type | Description |
|---|
| string | account_name |

GetCameraArmLength
local length = my_player:GetCameraArmLength(return_base?)
Parameters
| Type | Parameter | Default | Description |
|---|
| boolean | return_base? | false | Whether to return the current (false) or base (true) value. The base is the same value set by SetCameraArmLength(). Use base if you want to get the original value set by SetCameraArmLength() and not the current (interpolated) value. |
Returns
| Type | Description |
|---|
| float | length |
See also SetCameraArmLength.

GetCameraLocation
local location = my_player:GetCameraLocation()
See also SetCameraLocation.

GetCameraRotation
local rotation = my_player:GetCameraRotation()
See also SetCameraRotation.

GetControlledCharacter
local controlled_character = my_player:GetControlledCharacter()

GetDimension
Gets this Player's dimension
local dimension = my_player:GetDimension()
See also SetDimension, DimensionChange.

GetIP
local ip = my_player:GetIP()

GetName
local player_name = my_player:GetName()
Returns
| Type | Description |
|---|
| string | player_name |
See also SetName.

GetPing
local ping = my_player:GetPing()

GetSteamID
local steam_id = my_player:GetSteamID()

GetVOIPListeningChannels
Returns a list of VOIP channels this player is listening to
local ret = my_player:GetVOIPListeningChannels()

GetVOIPSpeakingChannels
Returns a list of VOIP channels this player is currently speaking to
local ret = my_player:GetVOIPSpeakingChannels()

IsHost
local is_host = my_player:IsHost()

IsLocalPlayer
local is_local_player = my_player:IsLocalPlayer()
Returns
| Type | Description |
|---|
| boolean | is_local_player |

IsVOIPMuted
Returns whether VOIP is muted for this player
local ret = my_player:IsVOIPMuted()
Returns
| Type | Description |
|---|
| boolean | No description provided |
See also SetVOIPMuted.

Kick
Kicks the player from the server
Parameters
| Type | Parameter | Default | Description |
|---|
| string | reason | Required parameter | No description provided |

Possess
Makes a Player to possess and control a Pawn (Character)
my_player:Possess(new_pawn, blend_time?, exp?)
Parameters
| Type | Parameter | Default | Description |
|---|
| Base Pawn | new_pawn | Required parameter | No description provided |
| float | blend_time? | 0 | No description provided |
| float | exp? | 0 | No description provided |

ResetCamera
Resets the Camera to default state (Unspectate and Detaches)

RotateCameraTo
Smoothly moves the Player's Camera Rotation
my_player:RotateCameraTo(rotation, time, exp?)
Parameters
| Type | Parameter | Default | Description |
|---|
| Rotator | rotation | Required parameter | No description provided |
| float | time | Required parameter | No description provided |
| float | exp? | 0 | Exponential used to smooth interp, use 0 for linear movement |

SetCameraArmLength
Sets the Player's Camera Arm Length (Spring Arm length)
my_player:SetCameraArmLength(length, force?)
Parameters
| Type | Parameter | Default | Description |
|---|
| float | length | Required parameter | No description provided |
| boolean | force? | false | Whether to bypass interpolation and set the target to its value directly |
See also GetCameraArmLength.

SetCameraFOV
Sets the Player's Camera FOV (if not possessing a Character)
my_player:SetCameraFOV(fov?)
Parameters
| Type | Parameter | Default | Description |
|---|
| float | fov? | 90 | Value must be between 5 and 170. Pass empty to reset to default. |

SetCameraLocation
Sets the Player's Camera Location (only works if not possessing any Character)
my_player:SetCameraLocation(location)
Parameters
| Type | Parameter | Default | Description |
|---|
| Vector | location | Required parameter | No description provided |
See also GetCameraLocation.

SetCameraRotation
Sets the Player's Camera Rotation
my_player:SetCameraRotation(rotation)
Parameters
| Type | Parameter | Default | Description |
|---|
| Rotator | rotation | Required parameter | No description provided |
See also GetCameraRotation.

SetCameraSocketOffset
Sets the Player's Camera Socket Offset (Spring Arm Offset)
my_player:SetCameraSocketOffset(socket_offset)
Parameters
| Type | Parameter | Default | Description |
|---|
| Vector | socket_offset | Required parameter | No description provided |

SetCameraSpeedSettings
Sets the Player's Camera Speed Settings (if not possessing a Character)
my_player:SetCameraSpeedSettings(max_speed?, acceleration?, deceleration?, turning_boost?)
Parameters
| Type | Parameter | Default | Description |
|---|
| float | max_speed? | 1200 | Maximum velocity magnitude allowed |
| float | acceleration? | 4000 | Acceleration applied by input (rate of change of velocity) |
| float | deceleration? | 4000 | Deceleration applied when there is no input (rate of change of velocity) |
| float | turning_boost? | 8 | Setting affecting extra force applied when changing direction, making turns have less drift and become more responsive. Velocity magnitude is not allowed to increase, that only happens due to normal acceleration. It may decrease with large direction changes. Larger values apply extra force to reach the target direction more quickly, while a zero value disables any extra turn force. |

SetDimension
Sets this Player's dimension
my_player:SetDimension(dimension)
Parameters
| Type | Parameter | Default | Description |
|---|
| integer | dimension | Required parameter | No description provided |
See also GetDimension, DimensionChange.

SetDistanceOptimizationMultiplier
Sets this Player's distance optimization multiplier.
A value of 0 disables optimization. Values under 1 decrease the effect, while values over 1 increase it
my_player:SetDistanceOptimizationMultiplier(multiplier)
Parameters
| Type | Parameter | Default | Description |
|---|
| float | multiplier | Required parameter | No description provided |

SetManualCameraFade
Turns on camera fading at the given opacity. Does not auto-animate, allowing user to animate themselves. Call StopCameraFade to turn fading back off.
my_player:SetManualCameraFade(in_fade_amount, color, in_fade_audio)
Parameters
| Type | Parameter | Default | Description |
|---|
| float | in_fade_amount | Required parameter | Range [0..1], where 0 is fully transparent and 1 is fully opaque solid color. |
| Color | color | Required parameter | No description provided |
| boolean | in_fade_audio | Required parameter | No description provided |

SetName
Sets the player's name
my_player:SetName(player_name)
Parameters
| Type | Parameter | Default | Description |
|---|
| string | player_name | Required parameter | No description provided |
See also GetName.

SetVOIPGlobalAllChannelsSetting
Sets the VOIP setting for all global channels
my_player:SetVOIPGlobalAllChannelsSetting(setting)
Parameters
| Type | Parameter | Default | Description |
|---|
| VOIPSetting | setting | Required parameter | No description provided |
See also SetVOIPGlobalChannelSetting, GetVOIPListeningChannels, GetVOIPSpeakingChannels, VOIPGlobalChannelSettingChange.

SetVOIPGlobalChannelSetting
Sets the VOIP setting for a specific global channel
my_player:SetVOIPGlobalChannelSetting(channel, setting)
Parameters
| Type | Parameter | Default | Description |
|---|
| integer | channel | Required parameter | 0-63 |
| VOIPSetting | setting | Required parameter | No description provided |
See also SetVOIPGlobalAllChannelsSetting, GetVOIPListeningChannels, GetVOIPSpeakingChannels, VOIPGlobalChannelSettingChange.

SetVOIPGlobalHighPassFilter
Sets the global VOIP high-pass filter threshold frequency. Set it to 0 to disable it
my_player:SetVOIPGlobalHighPassFilter(threshold)
Parameters
| Type | Parameter | Default | Description |
|---|
| integer | threshold | Required parameter | No description provided |
See also SetVOIPGlobalLowPassFilter.

SetVOIPGlobalLowPassFilter
Sets the global VOIP low-pass filter threshold frequency. Set it to 0 to disable it
my_player:SetVOIPGlobalLowPassFilter(threshold)
Parameters
| Type | Parameter | Default | Description |
|---|
| integer | threshold | Required parameter | No description provided |
See also SetVOIPGlobalHighPassFilter.

SetVOIPGlobalVolume
Sets the global VOIP volume. It only affects the global channels
my_player:SetVOIPGlobalVolume(volume)
Parameters
| Type | Parameter | Default | Description |
|---|
| float | volume | Required parameter | No description provided |

SetVOIPLocalMaxDistance
Sets the local/proximity VOIP max distance. This also affects networking usage
my_player:SetVOIPLocalMaxDistance(max_distance)
Parameters
| Type | Parameter | Default | Description |
|---|
| integer | max_distance | Required parameter | Falloff Distance. Default is 3600 |
See also SetVOIPLocalSetting, SetVOIPLocalVolume.

SetVOIPLocalSetting
Sets the VOIP setting for the local/proximity
my_player:SetVOIPLocalSetting(setting)
Parameters
| Type | Parameter | Default | Description |
|---|
| VOIPSetting | setting | Required parameter | No description provided |
See also SetVOIPLocalMaxDistance, SetVOIPLocalVolume, VOIPLocalSettingChange.

SetVOIPLocalVolume
Sets the local/proximity VOIP input/output volume. It only affects the local/proximity channel
my_player:SetVOIPLocalVolume(volume)
Parameters
| Type | Parameter | Default | Description |
|---|
| float | volume | Required parameter | No description provided |
See also SetVOIPLocalSetting, SetVOIPLocalMaxDistance, VOIPLocalSettingChange.

SetVOIPMuted
Mutes or unmutes VOIP for this player
my_player:SetVOIPMuted(is_muted)
Parameters
| Type | Parameter | Default | Description |
|---|
| boolean | is_muted | Required parameter | No description provided |
See also IsVOIPMuted.

Spectate
Spectates other Player
my_player:Spectate(player, blend_speed?)
Parameters
| Type | Parameter | Default | Description |
|---|
| Player | player | Required parameter | No description provided |
| float | blend_speed? | 0 | No description provided |

StartCameraFade
Does a camera fade to/from a solid color. Animates automatically
my_player:StartCameraFade(from_alpha, to_alpha, duration, to_color, should_fade_audio?, hold_when_finished?)
Parameters
| Type | Parameter | Default | Description |
|---|
| float | from_alpha | Required parameter | Alpha at which to begin the fade. Range [0..1], where 0 is fully transparent and 1 is fully opaque solid color. |
| float | to_alpha | Required parameter | Alpha at which to finish the fade. |
| float | duration | Required parameter | How long the fade should take, in seconds. |
| Color | to_color | Required parameter | Color to fade to/from. |
| boolean | should_fade_audio? | | True to fade audio volume along with the alpha of the solid color. |
| boolean | hold_when_finished? | | True for fade to hold at the ToAlpha until explicitly stopped (e.g. with StopCameraFade) |

StopCameraFade
Stops camera fading.
my_player:StopCameraFade()

TranslateCameraTo
Smoothly moves the Player's Camera Location (only works if not possessing any Character)
my_player:TranslateCameraTo(location, time, exp?)
Parameters
| Type | Parameter | Default | Description |
|---|
| Vector | location | Required parameter | No description provided |
| float | time | Required parameter | No description provided |
| float | exp? | 0 | Exponential used to smooth interp, use 0 for linear movement |

UnPossess
Release the Player from the Character
🚀 Events
Inherited Entity Events
| Name | Description |
|---|
 | DimensionChange | Triggered when a Player changes its dimension |
 | Possess | Triggered when Player starts controlling a Pawn (Character) |
 | Ready | Triggered when Player is ready (the client fully joined, loaded the map and all entities and is ready to play) |
 | UnPossess | A Pawn (Character) was unpossessed from the Player |
 | VOIP | When a Player starts/ends using VOIP |
 | VOIPGlobalChannelSettingChange | Triggered when a global VOIP channel setting changes for this player |
 | VOIPLocalSettingChange | Triggered when the local VOIP setting changes for this player |

DimensionChange
Triggered when a Player changes its dimension
Player.Subscribe("DimensionChange", function(self, old_dimension, new_dimension)
end)
Arguments
| Type | Argument | Description |
|---|
| Player | self | No description provided |
| integer | old_dimension | No description provided |
| integer | new_dimension | No description provided |
See also SetDimension, GetDimension.

Possess
Triggered when Player starts controlling a Pawn (Character)
Player.Subscribe("Possess", function(self, pawn)
end)
Arguments
| Type | Argument | Description |
|---|
| Player | self | No description provided |
| Base Pawn | pawn | No description provided |
See also GetControlledCharacter.

Ready
Triggered when Player is ready (the client fully joined, loaded the map and all entities and is ready to play)
Player.Subscribe("Ready", function(self)
end)
Arguments
| Type | Argument | Description |
|---|
| Player | self | No description provided |

UnPossess
A Pawn (Character) was unpossessed from the Player
Player.Subscribe("UnPossess", function(self, pawn)
end)
Arguments
| Type | Argument | Description |
|---|
| Player | self | No description provided |
| Base Pawn | pawn | No description provided |
See also GetControlledCharacter.

VOIP
When a Player starts/ends using VOIP
When 'is_talking' is true, return false to prevent this voice stream from playing (on server will prevent for everyone, on client will prevent only for the client)
Player.Subscribe("VOIP", function(self, is_talking)
return true
end)
Arguments
| Type | Argument | Description |
|---|
| Player | self | No description provided |
| boolean | is_talking | No description provided |

VOIPGlobalChannelSettingChange
Triggered when a global VOIP channel setting changes for this player
Player.Subscribe("VOIPGlobalChannelSettingChange", function(self, channel, old_setting, new_setting)
end)
Arguments
| Type | Argument | Description |
|---|
| Player | self | No description provided |
| integer | channel | No description provided |
| VOIPSetting | old_setting | No description provided |
| VOIPSetting | new_setting | No description provided |
See also SetVOIPGlobalChannelSetting, SetVOIPGlobalAllChannelsSetting.

VOIPLocalSettingChange
Triggered when the local VOIP setting changes for this player
Player.Subscribe("VOIPLocalSettingChange", function(self, old_setting, new_setting)
end)
Arguments
| Type | Argument | Description |
|---|
| Player | self | No description provided |
| VOIPSetting | old_setting | No description provided |
| VOIPSetting | new_setting | No description provided |
See also SetVOIPLocalSetting.