I have a script that is responsible for the loading screen gui and when the player Press start they fire a bindable event to the other script responsible for linking the gui to a Button.Activated event. However, the script responsible for the loading screen is in the Replicated First meanwhile the script that receives the bindable event is inside player scripts. and the player’s character doesn’t spawn until the player press Start which means the second script doesn’t load until the character is spawned making the bindable event fire at nothing (as the listeners have not been set yet).
to shorten this, is there a way to make sure that the script is loaded before firing the event?
well the problem is I have a few WaitForChild() inside the second script (the one inside the player scripts) which delay setting up the listeners a bit
No, I mean that you have the option in the main script (the loading screen controller) to check whether all scripts (listeners) exist using this method.
Another option would be to create a global variable, such as _G.Loaded = true . This would save you the need to create a bindable event to tell other scripts that the loading screen is finished.