Hey guys!! Working on a little project and I’d like some feedback on whether this code is formatted as efficiently as it can be. Essentially, im declaring all my functions, sounds etc. at the start and then once my clientevent is activated it runs everything. Keep in mind the function of this is to load up the first part of my game
TLDR: Is declaring everything then putting into one function triggered upon event efficient??
task.wait() should be used instead of wait(), task.delay instead of delay etc.
task library is more consistent and accurate and is meant to replace their soon-to-be deprecated counterparts. (they didn’t just update the function and instead made a new library because it may or may not break old games and make people sad abt it)
In the OnClientEvent function there are some not exactly necessary Instance.new() calls.
Instead of creating the instances inside the client event function, you could improve efficiency by creating the instances along with the rest of your declarations, this way you can reuse the instances instead of creating new ones every time the function runs.
To answer this, yes. Other than that, why don’t you make the GUI outside the OnClientEvent? It’s slower as it has to make GUI every time the remote is fired, not to mention if the remote gets fired multiple times there will be an overlap.