Skip to content

Scripting (Luau)

Vertexia embeds a complete Luau Virtual Machine. Server logic is executed via Script instances, while client logic executes via LocalScript instances. Both leverage the custom InstanceApi to interact with the engine.

Global Environment

  • workspace: Direct reference to the Workspace container holding all physical objects.
  • ui_node: Direct reference to the root UI layer canvas.
  • Players: Direct reference to the group node managing all connected player characters.
  • game: A structured table exposing { Workspace = workspace, UI = ui_node, Players = Players }.
  • script: A self-reference to the specific script executing the current thread.

Instance API

Instances are created using the standard factory pattern.

Instance.new

Instantiates a new engine object. Instance.new(ClassName: string, Parent?: VertexiaInstance)

Supported ClassNames: Part, Cube, Sphere, Cylinder, Wedge, CornerWedge, Truss, Hinge, Seat, Weld, TextLabel, Model, UIText, UIButton, UIImage, Sound, Explosion, NPC, RemoteEvent.

IsPlayerTouching

Detects if a player is physically overlapping a specific brick. Returns the player node or nil. IsPlayerTouching(TargetBrick: VertexiaInstance)

Custom Data Types

Vertexia injects standard data structures mapped to the internal engine mathematics.

  • Vector3.new(X: number, Y: number, Z: number)
  • Color.new(R: number, G: number, B: number, A?: number)

Signal Management

Engine events are managed through a custom RBXScriptSignal wrapper mapped into Luau metatables.

  • TargetInstance.Touched:Connect(CallbackFunction)
  • TargetInstance.TouchStarted:Connect(CallbackFunction)
  • TargetInstance.TouchEnded:Connect(CallbackFunction)

All callbacks are automatically wrapped in native coroutines to ensure non-blocking execution across the engine loop.

Task API

The task library handles coroutine yielding and engine-step deferral.

  • task.spawn(Function, ...): Immediately invokes a function on a separate coroutine thread.
  • task.wait(Time): Yields the current thread for the specified amount of seconds, resuming on the next engine process tick. (Also aliased globally as wait).