Event

Overview

Events are used to implement necessary functions for various situations that occur within the game (such as entering, collisions, etc.).

Linking a Function to an Event

Use :Connect() to link a function to an event.

Unlinking a Function from an Event

If you store the returned value in a variable when you use :Connect() to link a function to an event, you can unlink the function from the event when it is no longer needed.

Waiting for an Event

Using Wait() blocks the current thread until the signal fires once, then returns the arguments that were passed when it fired. The examples below show how to use those return values or chain waits in more involved flows.

When a player joins, wait for their character to be ready, then initialize Humanoid (Server)

Use the instance returned by Wait() for follow-up work

Signals that return multiple values: AncestryChanged passes (child, parent)

Wait once for server-sent data via RemoteEvent, then run logic (Client)

Commonly Used Events

Collision Events

Detects objects that collide with an object to which the event is linked. (For example: Detecting characters that touch a Kill Part)

Detects objects that exit the area (collision range) of the object to which the event is linked. (For example: Escaping from a trap floor)

Update Events

An event that is called every frame. (For example: Timer calculations, object movement, physics operations)

Player Join/Leave Events

An event that detects players who join the game.

An event that detects players who leave the game.

Character Spawn/Death Events

These are events that detect when a character is spawned or when a character dies.

Button Click Events

An event that is triggered when a button is clicked.

Last updated