What is the issue? Include screenshots / videos if possible!
‘Attempt To Index Function With Connect’
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
None Dont know how to fix this., And Cant find anything regarding to this…
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
ModuleScript:
function AziriCast.Collided() -- checks if ray collided then fires the event.
if AziriCast == false then return end
local CollidedEvent = Instance.new("BindableEvent")
local self = setmetatable({
Collided = CollidedEvent.Event;
},AziriCast)
if ray.Instance then
CollidedEvent:Fire()
end
return self
end
function AziriCast.new()
local self = setmetatable({
_Connections = {}
}, AziriCast)
return self
end
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)
end,
}
end
function AziriCast:Fire(...)
for _, Connection in ipairs(self._Connections) do
coroutine.wrap(Connection)(...)
end
end
-- Separate Script
local Test = AziriCast.new()
local Connection = Test:OnCollided(function(Result)
print(Result)
end)
Test:Fire("Foo")
Connection:Disconnect()
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