Any way to return values from another script?

I know that module scripts exist to do this but what I wanna see if you can do a function like 1+1 in a script and then return it which then another script can capture the return value and print it

I’m not sure but maybe BindableFunctions can be an alternative.

That would be Bindable Events. But really, you would be better off using a Module Script.

Hmm I’m pretty sure BindableFunctions can be used from any script and can return whatever you want just like a normal function.
But yes, I don’t see why using a ModuleScript would be a problem, and actually it might work even better than a bindable function/event.

1 Like

Yes, as others were saying here you could easily use bindeable functions to do this but why? Also why not use modulescripts in the first place. A majority of the most popular games on the platform i believe employ a single script architecture which makes the code so much more maintainable and also allows for much easier implementation of other things.

Module scripts don’t fit the need that I am doing here

Modules can do this perfectly, and they’re much easier to maintain than bindables.

Check out this tutorial for a greater expansion of knowledge.

1 Like

Event: Take a value, do something with it
Function: Take a value, do something with it, then return the value to the caller.

Basically: Event:FireServer(number) would do a function, but you can
local value = Event:Invoke(number) would return the value. In this case value would be 2.