Making Events on ModuleScript

What do you mean by events, do you mean a callback function?

	local self = setmetatable({
		_Connections = {}
	}, AziriCast)

	return self

function AziriCast:OnCollided(callback)
	assert(typeof(callback) == "function", "Invalid Argument!")
	local index = table.insert(self._Connections, callback)
	return {
		Disconnect = function()
			table.remove(self._Connections, index)

function AziriCast:Fire(...)
	for _, Connection in ipairs(self._Connections) do

-- Separate Script
local Test =

local Connection = Test:OnCollided(function(Result)


Could you maybe explain what this script does? i dont quite understand it thanks!

  • The OnCollided method is the connection similar to bindable events Event:Connect(...).
  • Fire method well just call the function on self._Connections table.

I’m not sure if this is the events that you where looking for, without using bindable events.

1 Like

Okay, ill try it out i think it is the event im looking for.

Im not really sure on how to import this since i dont really understand i dont think im in the level needed for it, do you have any documentation links that matches this? like assert, self, _connections

  • assert is just an if statement, if the condition returns false it will error, the sconed argument is the message. More info about assert

  • self is the reference of the variable which in this case local Test = More information about OOP

  • _Connections is the table which stores the functions that called the OnCollided method.

1 Like

Thank you! will experiment on it and check if it works, using a similar method!

well did you try to require “ArziCast” module and call Colided() function?

I mean:

local ArziCast = require(path).Collided()

local ArziCast = require(path)


i did it like this,

edit the first line:

local ArziCast = require(path).Collided()

use a signal module like GoodSignal and just create an event that you fire whenever just as it were a BindableEvent

im trying to make my own event without relaying on other modules.

Dosent work, and i didnt expect it to work either, im going to try MakerDoe’s Solution

im trying to test this on another script, how could i? i still really dont understand how it really works :frowning:

why? just use a module that works well

because as far as i know you cant require a module in another module.

you most certainly can, who told you that?

You can require any module inside a module, You probably can’t require the module you’re writing that in, like requiring ModuleScript1 In ModuleScript1