Passer au contenu principal
Version: bleeding-edge 🩸

Base Entity

Entity is the base for all Classes, and all those entities share the same Methods and Events described in this page.

🧑‍💻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!
👪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, Light, Melee, Particle, Player, Prop, SceneCapture, StaticMesh, Sound, TextRender, Trigger, VehicleWheeled, VehicleWater, Weapon, WebUI, Widget, Widget3D.

🗿 Static Functions

tip

The following functions are accessed statically using the specific class with a dot. Exemple: Character.GetAll().

ReturnsNameDescription
of Returns a table containing all Entities of the class this is called on
Returns a specific Entity of this class at an index
Returns how many Entities of this class exist
of Gets a list of all directly inherited classes from this Class created with the Inheriting System
Returns an iterator with all Entities of this class to be used with pairs()
or Gets the parent class if this Class was created with the Inheriting System
Inherits this class with the Inheriting System
Gets if this Class is child of another class if this Class was created with the Inheriting System
Subscribes to an Event for all entities of this Class
Subscribes to a custom event called from server
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

— Returns of (Copy of table containing all Entities).

local ret = Entity.GetAll()

GetByIndex

Returns a specific Entity of this class at an index

— Returns (Entity at index).

local ret = Entity.GetByIndex(index)
TypeParameterDefaultDescription
index Required parameter The index of the Entity

GetCount

Returns how many Entities of this class exist

— Returns (Number of Entities of this class).

local ret = Entity.GetCount()

GetInheritedClasses

Gets a list of all directly inherited classes from this Class created with the Inheriting System

— Returns of (All children Classes).

local ret = Entity.GetInheritedClasses(recursively?)
TypeParameterDefaultDescription
recursively?falseReturns all inherited children

GetPairs

Returns an iterator with all Entities of this class to be used with pairs(). This is a more performant method than GetAll(), 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 a GetPairs() loop will cause the iterable to change size during the process. If you want to loop-and-destroy, please use GetAll().

— Returns (Iterator with all Entities of this class).

local ret = Entity.GetPairs()

GetParentClass

Gets the parent class if this Class was created with the Inheriting System

— Returns or (The parent class).

local ret = Entity.GetParentClass()

Inherit

Inherits this class with the Inheriting System

— Returns (The new Class table).

local ret = Entity.Inherit(name, custom_values)
TypeParameterDefaultDescription
name Required parameter The name of the new Class
or custom_values Required parameter An optional table with custom values to be set in the inherited class table

IsChildOf

Gets if this Class is child of another class if this Class was created with the Inheriting System

— Returns .

local ret = Entity.IsChildOf(class)
TypeParameterDefaultDescription
class Required parameter The other class to check

Subscribe

Subscribes to an Event for all entities of this Class

— Returns (Callback that was passed (useful for unsubscribing later if your callback is an anonymous function)).

local ret = Entity.Subscribe(event_name, callback)
TypeParameterDefaultDescription
event_name Required parameter Name of the event to subscribe to
callback Required parameter Function to call when the event is triggered

SubscribeRemote

Subscribes to a custom event called from server

— Returns (Callback that was passed (useful for unsubscribing later if your callback is an anonymous function)).

local ret = Entity.SubscribeRemote(event_name, callback)
TypeParameterDefaultDescription
event_name Required parameter Name of the event to subscribe to
callback Required parameter Function to call when the event is triggered

Unsubscribe

Unsubscribes all callbacks from this Event in this Class within this Package, or only the callback passed

Entity.Unsubscribe(event_name, callback?)
TypeParameterDefaultDescription
event_name Required parameter Name of the event to unsubscribe from
callback?nilOptional callback to unsubscribe

🦠 Functions

ReturnsNameDescription
Calls a custom remote event directly on this entity to all Players
Calls a custom remote event directly on this entity to a specific Player
Calls a custom remote event directly on this entity
Destroys this Entity
of Gets a list of all values keys
Gets the class of this entity
Gets the universal network ID of this Entity (same on both client and server)
Gets a Value stored on this Entity at the given key
Recursively checks if this entity is inherited from a Class
Returns true if this Entity is valid (i.e. wasn't destroyed and points to a valid Entity)
Sets a Value in this Entity
Subscribes to an Event on this specific entity
Subscribes to a custom event called from server on this specific entity
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

my_entity:BroadcastRemoteEvent(event_name, args...?)
TypeParameterDefaultDescription
event_name Required parameter The Event Name to trigger the event
args...?nilArguments to pass to the event

CallRemoteEvent

Calls a custom remote event directly on this entity to a specific Player

my_entity:CallRemoteEvent(event_name, player, args...?)
TypeParameterDefaultDescription
event_name Required parameter The Event Name to trigger the event
Playerplayer Required parameter The remote player to send this event
args...?nilArguments to pass to the event

CallRemoteEvent

Calls a custom remote event directly on this entity

my_entity:CallRemoteEvent(event_name, args...?)
TypeParameterDefaultDescription
event_name Required parameter The Event Name to trigger the event
args...?nilArguments to pass to the event

Destroy

Destroys this Entity

my_entity:Destroy()

GetAllValuesKeys

Gets a list of all values keys

— Returns of (a list with all values keys).

local ret = my_entity:GetAllValuesKeys()

See also GetValue, SetValue.


GetClass

Gets the class of this entity

— Returns .

local ret = my_entity:GetClass()

GetID

Gets the universal network ID of this Entity (same on both client and server)

— Returns .

local ret = my_entity:GetID()

GetValue

Gets a Value stored on this Entity at the given key. Please refer to Entity Values for more information

— Returns (Value at key or fallback if key doesn't exist).

local ret = my_entity:GetValue(key, fallback)
TypeParameterDefaultDescription
key Required parameter No description provided
fallback Required parameter Fallback value if key doesn't exist

See also GetAllValuesKeys, SetValue.


IsA

Recursively checks if this entity is inherited from a Class

— Returns .

local ret = my_entity:IsA(class)
TypeParameterDefaultDescription
class Required parameter The Class

IsValid

Returns true if this Entity is valid (i.e. wasn't destroyed and points to a valid Entity)

— Returns .

local ret = my_entity:IsValid()

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?)
TypeParameterDefaultDescription
key Required parameter No description provided
value Required parameter No description provided
sync_on_clients?falseServer side parameter, if enabled will sync this value with all clients

See also GetAllValuesKeys, GetValue.


Subscribe

Subscribes to an Event on this specific entity

— Returns (Callback that was passed (useful for unsubscribing later if your callback is an anonymous function)).

local ret = my_entity:Subscribe(event_name, callback)
TypeParameterDefaultDescription
event_name Required parameter Name of the event to subscribe to
callback Required parameter Function to call when the event is triggered

SubscribeRemote

Subscribes to a custom event called from server on this specific entity

— Returns (Callback that was passed (useful for unsubscribing later if your callback is an anonymous function)).

local ret = my_entity:SubscribeRemote(event_name, callback)
TypeParameterDefaultDescription
event_name Required parameter Name of the event to subscribe to
callback Required parameter Function to call when the event is triggered

Unsubscribe

Unsubscribes all callbacks from this Event in this Entity within this Package, or only the callback passed

my_entity:Unsubscribe(event_name, callback?)
TypeParameterDefaultDescription
event_name Required parameter Name of the event to unsubscribe from
callback?nilOptional callback to unsubscribe

🚀 Events

NameDescription
Triggered when a new Class is registered with the Inheriting System
Triggered when an Entity is destroyed
Triggered when an Entity is spawned/created
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)
TypeArgumentDescription
classThe inherited Class

Destroy

Triggered when an Entity is destroyed
Entity.Subscribe("Destroy", function(self)
-- Destroy was called
end)
TypeArgumentDescription
selfThe Entity which that was destroyed

Spawn

Triggered when an Entity is spawned/created
Entity.Subscribe("Spawn", function(self)
-- Spawn was called
end)
TypeArgumentDescription
selfThe 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)
TypeArgumentDescription
selfThe Entity that just had a value changed
keyThe key used
valueThe value that was set