👩💻 Player
Players are Entities that represents the individual behind the mouse and keyboard. Players are spawned automatically when connected to the server.
🟥 You cannot spawn or Destroy Players.
🎒 Examples
-- Spawns and possess a Character when a Player joins the server
Player.Subscribe("Spawn", function(player)
local new_char = Character(Vector(), Rotator(), "nanos-world::SK_Male")
player:Possess(new_char)
end)
-- Destroys the Character when the Player leaves the server
Player.Subscribe("Destroy", function(player)
local character = player:GetControlledCharacter()
if (character) then
character:Destroy()
end
end)
🗿 Static Functions
Inherited Entity Static Functions
Base Entityscripting-reference/classes/base-classes/entity
| Returns | Name | Description | |
|---|---|---|---|
| table of Base Entity | GetAll | Returns a table containing all Entities of the class this is called on | |
| Base Entity | GetByIndex | Returns a specific Entity of this class at an index | |
| integer | GetCount | Returns how many Entities of this class exist | |
| table of table | GetInheritedClasses | Gets a list of all directly inherited classes from this Class created with the Inheriting System | |
| iterator | GetPairs | Returns an iterator with all Entities of this class to be used with pairs() | |
| table or nil | GetParentClass | Gets the parent class if this Class was created with the Inheriting System | |
| table | Inherit | Inherits this class with the Inheriting System | |
| boolean | IsChildOf | Gets if this Class is child of another class if this Class was created with the Inheriting System | |
| function | Subscribe | Subscribes to an Event for all entities of this Class | |
| function | SubscribeRemote | Subscribes to a custom event called from server | |
Unsubscribe | Unsubscribes all callbacks from this Event in this Class within this Package, or only the callback passed |
| Returns | Name | Description | |
|---|---|---|---|
| Player or nil | GetBySteamID | Retrieves a player by their Steam ID |
Slow

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
Base Entityscripting-reference/classes/base-classes/entity
| Returns | Name | Description | |
|---|---|---|---|
BroadcastRemoteEvent | Calls a custom remote event directly on this entity to all Players | ||
BroadcastRemoteInRadiusEvent | Calls a custom remote event directly on this entity to all Players in a radius | ||
CallRemoteEvent | Calls a custom remote event directly on this entity to a specific Player | ||
CallRemoteEvent | Calls a custom remote event directly on this entity | ||
CallRemotePlayersEvent | Calls a custom remote event directly on this entity to a list of Players | ||
Destroy | Destroys this Entity | ||
FinishSpawn | Finish the spawning process and send the entity to clients if it was spawned with defer_spawn | ||
| table of string | GetAllValuesKeys | Gets a list of all values keys | |
| table | GetClass | Gets the class of this entity | |
| integer | GetID | Gets the universal network ID of this Entity (same on both client and server) | |
| any | GetValue | Gets a Value stored on this Entity at the given key | |
| boolean | HasAuthority | Gets if the local context has authority over this Entity (true if spawned by the client, false if spawned by the server) | |
| boolean | IsA | Recursively checks if this entity is inherited from a Class | |
| boolean | IsBeingDestroyed | Returns true if this Entity is being destroyed | |
| boolean | IsValid | Returns true if this Entity is valid (i.e. wasn't destroyed and points to a valid Entity) | |
SetValue | Sets a Value in this Entity | ||
| function | Subscribe | Subscribes to an Event on this specific entity | |
| function | SubscribeRemote | Subscribes to a custom event called from server on this specific entity | |
Unsubscribe | Unsubscribes all callbacks from this Event in this Entity within this Package, or only the callback passed |
| Returns | Name | Description | |
|---|---|---|---|
AttachCameraTo | Attaches the Player`s Camera to an Actor | ||
Ban | Bans the player from the server | ||
Connect | Redirects the player to another server | ||
| string | GetAccountIconURL | Return a URL which can be used through WebUI and Widgets to display the Player's Steam Avatar (64x64) | |
| string | GetAccountID | No description provided | |
| string | GetAccountName | No description provided | |
| float | GetCameraArmLength | No description provided | |
| Vector | GetCameraLocation | No description provided | |
| Rotator | GetCameraRotation | No description provided | |
| Base Pawn or nil | GetControlledCharacter | No description provided | |
| integer | GetDimension | Gets this Player's dimension | |
| string | GetIP | No description provided | |
| string | GetName | No description provided | |
| integer | GetPing | No description provided | |
| string | GetSteamID | No description provided | |
| table of integer | GetVOIPListeningChannels | Returns a list of VOIP channels this player is listening to | |
| table of integer | GetVOIPSpeakingChannels | Returns a list of VOIP channels this player is currently speaking to | |
| boolean | IsHost | No description provided | |
| boolean | IsLocalPlayer | No description provided | |
| boolean | IsVOIPMuted | Returns whether VOIP is muted for this player | |
Kick | Kicks the player from the server | ||
Possess | Makes a Player to possess and control a Pawn (Character) | ||
ResetCamera | Resets the Camera to default state (Unspectate and Detaches) | ||
RotateCameraTo | Smoothly moves the Player's Camera Rotation | ||
SetCameraArmLength | Sets the Player's Camera Arm Length (Spring Arm length) | ||
SetCameraFOV | Sets the Player's Camera FOV (if not possessing a Character) | ||
SetCameraLocation | Sets the Player's Camera Location (only works if not possessing any Character) | ||
SetCameraRotation | Sets the Player's Camera Rotation | ||
SetCameraSocketOffset | Sets the Player's Camera Socket Offset (Spring Arm Offset) | ||
SetCameraSpeedSettings | Sets the Player's Camera Speed Settings (if not possessing a Character) | ||
SetDimension | Sets this Player's dimension | ||
SetDistanceOptimizationMultiplier | Sets this Player's distance optimization multiplier | ||
SetManualCameraFade | Turns on camera fading at the given opacity | ||
SetName | Sets the player's name | ||
SetVOIPGlobalAllChannelsSetting | Sets the VOIP setting for all global channels | ||
SetVOIPGlobalChannelSetting | Sets the VOIP setting for a specific global channel | ||
SetVOIPGlobalHighPassFilter | Sets the global VOIP high-pass filter threshold frequency | ||
SetVOIPGlobalLowPassFilter | Sets the global VOIP low-pass filter threshold frequency | ||
SetVOIPGlobalVolume | Sets the global VOIP volume. It only affects the global channels | ||
SetVOIPLocalMaxDistance | Sets the local/proximity VOIP max distance. This also affects networking usage | ||
SetVOIPLocalSetting | Sets the VOIP setting for the local/proximity | ||
SetVOIPLocalVolume | Sets the local/proximity VOIP input/output volume. It only affects the local/proximity channel | ||
SetVOIPMuted | Mutes or unmutes VOIP for this player | ||
Spectate | Spectates other Player | ||
StartCameraFade | Does a camera fade to/from a solid color | ||
StopCameraFade | Stops camera fading. | ||
TranslateCameraTo | Smoothly moves the Player's Camera Location (only works if not possessing any Character) | ||
UnPossess | Release the Player from the Character |
Optimal

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 |
Slow

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

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? | | Serverpasswort |
Optimal

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 |
Optimal

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

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

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.
Optimal

GetCameraLocation
local location = my_player:GetCameraLocation()
Returns
| Type | Description |
|---|---|
| Vector | location |
See also SetCameraLocation.
Optimal

GetCameraRotation
local rotation = my_player:GetCameraRotation()
Returns
| Type | Description |
|---|---|
| Rotator | rotation |
See also SetCameraRotation.
Optimal

GetControlledCharacter
local controlled_character = my_player:GetControlledCharacter()
Optimal

GetDimension
Gets this Player's dimension
local dimension = my_player:GetDimension()
Returns
| Type | Description |
|---|---|
| integer | dimension |
See also SetDimension, DimensionChange.
Optimal

GetIP
local ip = my_player:GetIP()
Returns
| Type | Description |
|---|---|
| string | ip |
Optimal

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

GetPing
local ping = my_player:GetPing()
Returns
| Type | Description |
|---|---|
| integer | ping |
Optimal

GetSteamID
local steam_id = my_player:GetSteamID()
Returns
| Type | Description |
|---|---|
| string | steam_id |
Moderate

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

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

IsHost
local is_host = my_player:IsHost()
Returns
| Type | Description |
|---|---|
| boolean | is_host |
Optimal

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

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

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

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 |
Optimal

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

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 |
Optimal

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.
Optimal

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. |
Optimal

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.
Optimal

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.
Optimal

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 |
Optimal

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. |
Slow

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.
Optimal

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 |
Optimal

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 |
Optimal

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.
Optimal

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.
Optimal

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.
Optimal

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.
Optimal

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.
Optimal

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 |
Optimal

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.
Optimal

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.
Optimal

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.
Optimal

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.
Optimal

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 |
Moderate

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? | false | True to fade audio volume along with the alpha of the solid color. |
| boolean | hold_when_finished? | false | True for fade to hold at the ToAlpha until explicitly stopped (e.g. with StopCameraFade) |
Optimal

StopCameraFade
Stops camera fading.
my_player:StopCameraFade()
Optimal

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 |
Optimal

UnPossess
Release the Player from the Character
my_player:UnPossess()
🚀 Events
Inherited Entity Events
Base Entityscripting-reference/classes/base-classes/entity
| Name | Description | |
|---|---|---|
ClassRegister | Triggered when a new Class is registered with the Inheriting System | |
Destroy | Triggered when an Entity is destroyed | |
Spawn | Triggered when an Entity is spawned/created | |
ValueChange | Triggered when an Entity has a value changed with :SetValue() |
| 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)
-- DimensionChange was called
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)
-- Possess was called
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)
-- Ready was called
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)
-- UnPossess was called
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)
-- VOIP was called
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)
-- VOIPGlobalChannelSettingChange was called
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)
-- VOIPLocalSettingChange was called
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.


