Reading time: ~40 minutes (reference material)
Table of Contents
Core Classes
CORP
Main entry point for the framework.Methods
CORP.start(configuration: Configurations.GameConfiguration): void
Starts CORP with a configuration object.
configuration.startingScene- Scene description or path to scene
CORP.startFromWorkspace(): void
Starts CORP using existing workspace instances (for rapid prototyping).
GameObject
Represents an entity in the game world. Container for Components.Constructor
name- Name of the GameObject
Properties
Methods
addComponent<T>(clazz: Constructable<T>, config?: ComponentConfig<T>): T
Adds a component to the GameObject.
clazz- Component class to addconfig- Optional configuration object
getComponent<T>(clazz: Constructable<T> | string): T | undefined
Gets a component from the GameObject.
clazz- Component class or path string
hasComponent<T>(clazz: Constructable<T>): boolean
Checks if GameObject has a component.
clazz- Component class to check
removeComponent<T>(clazz: Constructable<T>): void
Removes a component from the GameObject.
clazz- Component class to remove
destroy(): void
Destroys the GameObject and all its components.
setParent(parent: GameObject | Scene | undefined): void
Sets the parent of this GameObject.
parent- New parent GameObject, Scene, or undefined
getParent(): GameObject | Scene | undefined
Gets the parent of this GameObject.
getChildren(): GameObject[]
Gets all child GameObjects.
getDescendants(): GameObject[]
Gets all descendant GameObjects recursively.
getTransform(): CFrame
Gets the transform (position and rotation) of the GameObject.
setTransform(transform: CFrame): void
Sets the transform of the GameObject.
transform- New CFrame transform
getPosition(): Vector3
Gets the position of the GameObject.
getName(): string
Gets the name of the GameObject.
getInstance(): Actor
Gets the underlying Roblox Instance.
Static Methods
GameObject.fromInstance(instance: Actor, name: string): GameObject
Creates a GameObject from an existing Roblox Instance.
instance- Roblox Actor instancename- Name for the GameObject
GameObject.importGameObject(description: GameObjectDescription, parent: GameObject | Scene, isClient: boolean): GameObject
Imports a GameObject from a scene description.
Component
Abstract base class for all components.Constructor
gameObject- GameObject this component is attached toinitOnCreated- Whether to initialize immediately (default: true)
Properties
Methods
abstract onStart(): void
Called when the component starts. Must be implemented.
abstract willRemove(): void
Called before the component is removed. Must be implemented.
abstract getSourceScript(): LuaSourceContainer
Returns the script that defines this component. Must be implemented.
willStart(): void
Called before onStart. Override for pre-initialization.
onPropertiesApplied(): void
Called after properties are applied via serialization. Override to react to configuration.
initialize(): void
Initializes the component. Called internally by CORP.
remove(): void
Removes and destroys this component.
getGameObject(): GameObject
Gets the GameObject this component is attached to.
Component Shortcuts
These methods are shortcuts to GameObject methods:Behavior
Extends Component with serialization support. Use this as the base for most components.All Component Methods
Behavior inherits all methods from Component.Methods
serializeState(): Partial<Behavior>
Returns the serialized state of all @SerializeField properties.
Properties
Networking Classes
NetworkObject
Makes a GameObject replicate across the network.Constructor
Properties
Methods
spawn(): void
Spawns the NetworkObject on the network (server only).
changeOwnership(owner: Player | undefined): void (Server Only)
Changes the owner of this NetworkObject.
owner- New owner Player, or undefined for server
getOwner(): Player | undefined
Gets the current owner.
getId(): string
Gets the unique network ID.
NetworkBehavior
Network-replicated component. Requires NetworkObject.Constructor
All Behavior Methods
NetworkBehavior inherits all methods from Behavior.Methods
getNetworkObject(): NetworkObject
Gets the associated NetworkObject.
getId(): string
Gets the unique network behavior ID.
NetworkedVariable
Replicated variable that synchronizes between server and clients.Constructor
initialValue- Initial valueconfig- Configuration options
Properties
Methods
getValue(): T
Gets the current value.
setValue(value: T): void (Server Only)
Sets the value (server only).
value- New value
NetworkedList
Replicated list/array.Constructor
Properties
Methods
push(item: T): void (Server Only)
Adds an item to the end.
remove(index: number): T | undefined (Server Only)
Removes an item at index.
get(index: number): T | undefined
Gets an item at index.
set(index: number, value: T): void (Server Only)
Sets an item at index.
size(): number
Gets the size of the list.
NetworkedMap
Replicated map/dictionary.Constructor
Properties
Methods
set(key: K, value: V): void (Server Only)
Sets a key-value pair.
get(key: K): V | undefined
Gets a value by key.
delete(key: K): boolean (Server Only)
Deletes a key.
has(key: K): boolean
Checks if key exists.
NetworkedSet
Replicated set.Constructor
Properties
Methods
add(item: T): void (Server Only)
Adds an item to the set.
delete(item: T): boolean (Server Only)
Deletes an item from the set.
has(item: T): boolean
Checks if item exists in set.
RPC
Namespace for RPC decorator and configuration.Decorator
@RPC.Method(config: RPC.Config)
Marks a method as a Remote Procedure Call.
Configuration
Enums
RPC.Endpoint
CLIENT_TO_SERVER- Client calls serverSERVER_TO_CLIENT- Server calls clientCLIENT_TO_CLIENT- Client calls client (not yet implemented)CLIENT_LOCALLY- Client calls locallySERVER_LOCALLY- Server calls locally
RPC.AccessPolicy
NONE/ANYONE- Anyone can callOWNER- Only owner can callNOT_OWNER- Only non-owners can call
RPC.ReturnMode
DOES_NOT_RETURN/VOID- No return valueRETURNS- Returns a value
RPC.Reliability
RELIABLE- Guaranteed deliveryUNRELIABLE- Fast but may be dropped
Scene Management
SceneManager
Manages game scenes.Properties
Methods
static loadScene(scene: SceneSerialization.SceneDescription): Scene
Loads a scene.
scene- Scene description
static unloadScene(): void
Unloads the current scene.
static changeScene(scene: SceneSerialization.SceneDescription): void
Changes to a new scene (unloads current, loads new).
scene- Scene description
static importScene(scene: SceneSerialization.SceneDescription): Scene
Imports a scene from description without loading.
Scene
Represents a game scene.Properties
Methods
startFromWorkspace(): void
Starts the scene from existing workspace instances.
Utilities
Signal
Event system for type-safe callbacks.Constructor
name- Optional name for debugging
Methods
connect(callback: (...args: T) => void): Connection<T>
Connects a callback to the signal.
callback- Function to call when signal fires
fire(...args: T): void
Fires the signal with arguments.
...args- Arguments to pass to callbacks
destroy(): void
Destroys the signal and disconnects all connections.
Collector
Garbage collector for automatic resource cleanup.Methods
add(item: RBXScriptConnection | Instance | (() => void) | { destroy(): void }): void
Adds an item to be cleaned up.
item- Connection, Instance, function, or object with destroy method
teardown(): void
Cleans up all added items.
Type Definitions
SceneSerialization.SceneDescription
SceneSerialization.GameObjectDescription
SceneSerialization.ComponentDescription
Configurations.GameConfiguration
Next Steps
- Getting Started: Learn the basics
- Examples: See practical implementations
- Core Concepts: Understand the architecture
Complete API reference for building games with CORP! 📚