An Event in Roblox Lua, is when something occurs in game. This may be a part being touched, or a Player respawning. Events can be connected to a function, and this function will run when the event is called. Some events also come with arguments, that can be used.

Events are represented as RBXScriptSignals. When an event's :Connect() method is called, it creates a connection and returns a RBXScriptConnection, allowing this connection to be disconnected.


This example is an example of a ExplorerImageIndex 1.pngPart being touched.

local part ="Part", workspace)
local connection = part.Touched:Connect(function(hit)
    print("I've been touched by " .. hit.Name)

In this example, a part is being created. When it is touched, it prints the name of the touching part. 'hit' is an argument provided, which is the part touching the created part.

But what is the 'connection' variable? 'connection' is a RBXScriptConnection. An RBXScriptConnection is an object returned by the :Connect() function of an event.

Community content is available under CC-BY-SA unless otherwise noted.