githubEdit

Framework

The server framework of Utility Objectify is the core logic layer that manages the lifecycle of entity objects and their interaction with clients. It enables an object-oriented, decorator-based architecture that simplifies entity spawning, plugin composition, and client-server communication using RPC.

This page details how the server-side framework works and how to write server-side object scripts using the provided API.


🧱 BaseEntity Class

All server-side object scripts must extend BaseEntity. This class provides:

  • Constructor with coords (vec3) rotation? (vec3) and options? (table)

  • Entity creation, automatically called if passing coords in the constructor (:create)

  • Entity deletion (:destroy)

  • RPC access to the client (self.client)

  • Plugin management (self.plugins)

  • Child Entities methods and attributes Child Entities

  • Lifecycle hooks like OnSpawn,OnDestroy etc.

Methods provided

chevron-rightGeneralhashtag

self:create(coords)

Spawns a networked object in the world, automatically called when passing coords during class instantiation. calls OnAwake, OnSpawn and AfterSpawn

self:destroy()

Deletes the entity and removes the instance calling OnDestroy

Example


🌐 IsServer / IsClient Flags

To help with shared or conditional logic, Utility Objectify provides two constants:

Constant
Value
Description

IsClient

false

Always false on the server

IsServer

true

Always true on the server


πŸ”Ž Framework Functions

SetRPCNamespace(namespace)

Change the prefix used internally for RPC event names by default is Config.Namespace or the current resource name followed by a colon (:)

Client.DisableTimeoutForNext()

Disable the 5s timeout on callbacks for the next RPC call

Last updated