BindableFunctions vs ModuleScripts

Is one better than the other? I usually do everything with ModuleScripts but recently moved everything over to BindableFunctions (as it gives me a clean way to lay out their interfaces & gives me freedom over the structure of the game without worrying about breaking anything).

Just wondering if there’s a performance issue or something in doing that. Should I just stick to using require everywhere?

They’re both useful in different situations. BindableFunctions are better for sending data from one script to another and back, but ModuleScripts are better if more than two scripts need that data. It really depends on the situation. If you’re just using it to organize functions, I’d use a ModuleScript since it’s more intuitive when editing (you’ll know right away where the actual function responding to the function call is).

Performance difference is going to be negligible for most practical purposes. As you get more skilled in scripting and start creating more complex projects, the vast majority of people find modules to be the best way to organise your code, but if you think bindables are better, you can use them without worrying about performance.

1 Like

Module scripts are best if you plan on using object oriented programming, which is very powerful. For advanced projects, module scripts seem to work best for me. Module scripts can also be used by the server and client if its in ReplicatedStorage so its very versatile.

1 Like

Personally I prefer ModuleScripts simply because you don’t need to deal with the overhead of how bindables work i.e. a function in a ModuleScript is just a function, whereas a BindableFunction is an object that has limitations and stuff.

Also, I would say it’s good practice to use bindables for cross-script communication and modules for doing things.

Yes, I agree here. OOP is something that I used for an actual project. I like it a lot.

1 Like