As if Currently I keep restarting and deleting my project over and over again for no appearent reason.
Anyway, I was wondering on how to Manage Events, or Signals.
I Have a ModuleScript that creates a Connection when required, but Would this degrade performance if they are separate Events,
Like for Example: Lets say I had 3 Scripts that used PlayerAdded:
game.Players.PlayerAdded:Connect(function() -- Event
-- random code here brrrrrrrrrrrrrrrrrrrr
end)
Would Having these 3 Seperate Events for the same task be more efficient or cause some Issues since they fire at the same time?
Or Should I just have One Event that Fires a List of functions?
It won’t make enough of a performance difference that it’s worth making your scripts less readable. So if e.g. different systems need to listen to the event, just have several connections.
EDIT: For the example you showed I don’t think there would be any difference.
Roblox is an event and coroutine oriented engine, i.e. everything you do is done with events and coroutines.
That implies two things: developers don’t have to worry about events and coroutines because the engine takes care of that; and, when using events and coroutines, the logic and algorithms must adapt to them.
In the case of your example it will depend a lot on what each function does. But as stated above, you should use as many events as you need to make it easier to understand the code or logic of your game. Efficiency is the responsibility of the engine.
Remember that algorithms and logic are not the same as in traditional environments. When you have several functionalities each separated into events, the engine is the one who decides when they will be executed. But when you use a single event for everything, you decide when each functionality will be executed. This is very important when making a decision.