Could someone explain this?

Hi, could someone please provide an explanation on this? thank u :slight_smile:
basically, i was wondering how you could make functions like this in a module script and then require that module and call a finished or activated thing from it in another script, and if someone could provide an example of how i should do the activated function on the backend to make it so u can have it trigger as a function when its triggered

So basically, I need someone to (hopefully) explain how to do this:
Trigger an activated function
and i understand how to get the function when it’s activated, just not like how to make a function that connects to that

1 Like

I’m a little confused with what your asking. Are you hopeing to make something like this (A module that has Callbacks / RBXScriptSignal’s that another script can use ):

local MyModule = require(script.MyModule)

MyModule.CustomEvent:Connect(function()
 print("This event was fired")
end)

MyModule.CustomCallBack = function()
 print("This Callback  was fired")
end

And if so, which option (the 1st format / 2nd format). Or is it something completely different? and if so could you try and be a little more clearer / provide some examples / Why you need this and with what your using it for ?

yep! how would i do something like that with callbacks (2nd one)

I have done the event version (version one in my last post), however by doing some messing around you can do something like this and the use of returns, allow us to use callback connection!

Here is an example with one of these!

Module Script :

local AllCallbacks = {}



AllCallbacks["MyCustomCallback"] = function(Input)
	return Input
end

function AllCallbacks.CallbackEvent(Input) --This function is here so I can test a firing of the callback
	AllCallbacks.MyCustomCallback(Input)
end


return AllCallbacks

Script:

local MyModule = require(script.MyModule)

MyModule.MyCustomCallback = function(PrintString)
	print(PrintString)
end


task.wait(3)

MyModule.CallbackEvent("This Is An Example")

MyModule.CallbackEvent("And we can call it!!")

Hope it helps!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.