Base Entity
Entity is the base for all Classes, and all those entities share the same Methods and Events described in this page.
๐ชBase Class
This is a Base Class. Base Classes are abstract definitions used to share common methods and events between related child classes, thus you cannot spawn it directly.
Classes that share methods and events from this Base Class: Billboard, Blueprint, Cable, Character, CharacterSimple, Decal, Gizmo, Grenade, InstancedStaticMesh, Light, Melee, Particle, Player, Prop, SceneCapture, StaticMesh, Sound, TextRender, Text3D, Trigger, VehicleWheeled, VehicleWater, Weapon, WebUI, Widget, Widget3D.
Classes that share methods and events from this Base Class: Billboard, Blueprint, Cable, Character, CharacterSimple, Decal, Gizmo, Grenade, InstancedStaticMesh, Light, Melee, Particle, Player, Prop, SceneCapture, StaticMesh, Sound, TextRender, Text3D, Trigger, VehicleWheeled, VehicleWater, Weapon, WebUI, Widget, Widget3D.
๐งโ๐ป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!
๐ฟย Static Functionsโ
tip
The following functions are accessed statically using the specific class with a dot. Example: Character.GetAll().
| 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 |

GetAll
โ
Returns a table containing all Entities of the class this is called on
local ret = Entity.GetAll()
Returns
| Type | Description |
|---|---|
| table of Base Entity | Copy of table containing all Entities |

GetByIndex
โ
Returns a specific Entity of this class at an index
local ret = Entity.GetByIndex(index)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| integer | index | Required parameter | The index of the Entity |
Returns
| Type | Description |
|---|---|
| Base Entity | Entity at index |

GetCount
โ
Returns how many Entities of this class exist
local ret = Entity.GetCount()
Returns
| Type | Description |
|---|---|
| integer | Number of Entities of this class |

GetInheritedClasses
โ
Gets a list of all directly inherited classes from this Class created with the Inheriting System
local ret = Entity.GetInheritedClasses(recursively?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| boolean | recursively? | false | Returns all inherited children |

GetPairs
โ
Returns an iterator with all Entities of this class to be used withpairs(). This is a more performant method thanGetAll(), as it will return the iterator to access the Entities directly instead of creating and returning a copy of the Entities table.
Note: Destroying Entities from inside aGetPairs()loop will cause the iterable to change size during the process. If you want to loop-and-destroy, please useGetAll().
local ret = Entity.GetPairs()
Returns
| Type | Description |
|---|---|
| iterator | Iterator with all Entities of this class |

GetParentClass
โ
Gets the parent class if this Class was created with the Inheriting System
local ret = Entity.GetParentClass()

Inherit
โ
Inherits this class with the Inheriting System
local class = Entity.Inherit(name, custom_values?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | name | Required parameter | The name of the new Class |
| table | custom_values? | {} | An optional table with custom values to be set in the inherited class table |
Returns
| Type | Description |
|---|---|
| table | The new Class table |

IsChildOf
โ
Gets if this Class is child of another class if this Class was created with the Inheriting System
local ret = Entity.IsChildOf(class)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| table | class | Required parameter | The other class to check |
Returns
| Type | Description |
|---|---|
| boolean | No description provided |

Subscribe
โ
Subscribes to an Event for all entities of this Class
local ret = Entity.Subscribe(event_name, callback)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | event_name | Required parameter | Name of the event to subscribe to |
| function | callback | Required parameter | Function to call when the event is triggered |
Returns
| Type | Description |
|---|---|
| function | Callback that was passed (useful for unsubscribing later if your callback is an anonymous function) |

SubscribeRemote
โ
Subscribes to a custom event called from server
local ret = Entity.SubscribeRemote(event_name, callback)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | event_name | Required parameter | Name of the event to subscribe to |
| function | callback | Required parameter | Function to call when the event is triggered |
Returns
| Type | Description |
|---|---|
| function | Callback that was passed (useful for unsubscribing later if your callback is an anonymous function) |

Unsubscribe
โ
Unsubscribes all callbacks from this Event in this Class within this Package, or only the callback passed
Entity.Unsubscribe(event_name, callback?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | event_name | Required parameter | Name of the event to unsubscribe from |
| function | callback? | nil | Optional callback to unsubscribe |
๐ฆ ย Functionsโ
| 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 |

BroadcastRemoteEvent
โ
Calls a custom remote event directly on this entity to all Players
๐Updated Function
This method was recently updated in ver. 1.139. See the Compatibility Versions page for more information.
my_entity:BroadcastRemoteEvent(event_name, reliability?, args...?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | event_name | Required parameter | The Event Name to trigger the event |
| Reliability | reliability? | Reliability.Reliable | The network reliability rule |
| any | args...? | nil | Arguments to pass to the event |

BroadcastRemoteInRadiusEvent
โ
Calls a custom remote event directly on this entity to all Players in a radius
my_entity:BroadcastRemoteInRadiusEvent(event_name, radius, reliability?, args...?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | event_name | Required parameter | The Event Name to trigger the event |
| float | radius | Required parameter | The radius to send this event |
| Reliability | reliability? | Reliability.Reliable | The network reliability rule |
| any | args...? | nil | Arguments to pass to the event |

CallRemoteEvent
โ
Calls a custom remote event directly on this entity to a specific Player
๐Updated Function
This method was recently updated in ver. 1.139. See the Compatibility Versions page for more information.
my_entity:CallRemoteEvent(event_name, player, reliability?, args...?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | event_name | Required parameter | The Event Name to trigger the event |
| Player | player | Required parameter | The remote player to send this event |
| Reliability | reliability? | Reliability.Reliable | The network reliability rule |
| any | args...? | nil | Arguments to pass to the event |

CallRemoteEvent
โ
Calls a custom remote event directly on this entity
๐Updated Function
This method was recently updated in ver. 1.139. See the Compatibility Versions page for more information.
my_entity:CallRemoteEvent(event_name, reliability?, args...?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | event_name | Required parameter | The Event Name to trigger the event |
| Reliability | reliability? | Reliability.Reliable | The network reliability rule |
| any | args...? | nil | Arguments to pass to the event |

CallRemotePlayersEvent
โ
Calls a custom remote event directly on this entity to a list of Players
my_entity:CallRemotePlayersEvent(event_name, players, reliability?, args...?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | event_name | Required parameter | The Event Name to trigger the event |
| table of Player | players | Required parameter | The remote players to send this event |
| Reliability | reliability? | Reliability.Reliable | The network reliability rule |
| any | args...? | nil | Arguments to pass to the event |

Destroy
โ
Destroys this Entity
my_entity:Destroy()

FinishSpawn
โ
Finish the spawning process and send the entity to clients if it was spawned with defer_spawn. Call this after configuring the entity for efficient spawningmy_entity:FinishSpawn()

GetAllValuesKeys
โ
Gets a list of all values keys
local ret = my_entity:GetAllValuesKeys()

GetClass
โ
Gets the class of this entity
local class = my_entity:GetClass()
Returns
| Type | Description |
|---|---|
| table | class |

GetID
โ
Gets the universal network ID of this Entity (same on both client and server)
local id = my_entity:GetID()
Returns
| Type | Description |
|---|---|
| integer | id |

GetValue
โ
Gets a Value stored on this Entity at the given key. Please refer to Entity Values for more information
local value = my_entity:GetValue(key, fallback)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | key | Required parameter | No description provided |
| any | fallback | Required parameter | Fallback value if key doesn't exist |
Returns
| Type | Description |
|---|---|
| any | Value at key or fallback if key doesn't exist |
See also GetAllValuesKeys, SetValue.

HasAuthority
โ
Gets if the local context has authority over this Entity (true if spawned by the client, false if spawned by the server)
local ret = my_entity:HasAuthority()
Returns
| Type | Description |
|---|---|
| boolean | true if spawned by the client, false if spawned by the server |

IsA
โ
Recursively checks if this entity is inherited from a Class
local ret = my_entity:IsA(class)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| table | class | Required parameter | The Class |
Returns
| Type | Description |
|---|---|
| boolean | No description provided |

IsBeingDestroyed
โ
Returns true if this Entity is being destroyed.
You can check this inside events likeDropto see if a Pickable is being dropped because it's going to be destroyed
local ret = my_entity:IsBeingDestroyed()
Returns
| Type | Description |
|---|---|
| boolean | No description provided |

IsValid
โ
Returns true if this Entity is valid (i.e. wasn't destroyed and points to a valid Entity)
local is_valid = my_entity:IsValid()
Returns
| Type | Description |
|---|---|
| boolean | is_valid |

SetValue
โ
Sets a value in this Entity, which can be accessed by any package (optionally sync on clients if called from server)
Please refer to Entity Values for more information
my_entity:SetValue(key, value, sync_on_clients?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | key | Required parameter | No description provided |
| any | value | Required parameter | No description provided |
| boolean | sync_on_clients? | false | Server side parameter, if enabled will sync this value with all clients |
See also GetAllValuesKeys, GetValue.

Subscribe
โ
Subscribes to an Event on this specific entity
local ret = my_entity:Subscribe(event_name, callback)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | event_name | Required parameter | Name of the event to subscribe to |
| function | callback | Required parameter | Function to call when the event is triggered |
Returns
| Type | Description |
|---|---|
| function | Callback that was passed (useful for unsubscribing later if your callback is an anonymous function) |

SubscribeRemote
โ
Subscribes to a custom event called from server on this specific entity
local ret = my_entity:SubscribeRemote(event_name, callback)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | event_name | Required parameter | Name of the event to subscribe to |
| function | callback | Required parameter | Function to call when the event is triggered |
Returns
| Type | Description |
|---|---|
| function | Callback that was passed (useful for unsubscribing later if your callback is an anonymous function) |

Unsubscribe
โ
Unsubscribes all callbacks from this Event in this Entity within this Package, or only the callback passed
my_entity:Unsubscribe(event_name, callback?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | event_name | Required parameter | Name of the event to unsubscribe from |
| function | callback? | nil | Optional callback to unsubscribe |
๐ย Eventsโ
| 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() |

ClassRegisterโ
Triggered when a new Class is registered with the Inheriting System
Entity.Subscribe("ClassRegister", function(class)
-- ClassRegister was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| table | class | The inherited Class |

Destroyโ
Triggered when an Entity is destroyed
Entity.Subscribe("Destroy", function(self)
-- Destroy was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Entity | self | The Entity which that was destroyed |

Spawnโ
Triggered when an Entity is spawned/created
Entity.Subscribe("Spawn", function(self)
-- Spawn was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Entity | self | The Entity that was spawned |

ValueChangeโ
Triggered when an Entity has a value changed with :SetValue()Entity.Subscribe("ValueChange", function(self, key, value)
-- ValueChange was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Entity | self | The Entity that just had a value changed |
| string | key | The key used |
| any | value | The value that was set |