I personally just do the following:
Class Script:
PHP Code:
//#CLIENTSIDE
function onInitGUI() {
createGUI();
}
Weapon script:
PHP Code:
//#CLIENTSIDE
function onCreated() {
this.scheduleevent(0.05, "InitGUI", "");
}
I know for developing purposes you want to update it, and see the changes immediately but in the end you should be aiming for creating it only when it's needed.
I.e:
PHP Code:
//#CLIENTSIDE
function onCreated() {
this.join("gui_design");
}
function onWeaponFired() {
if (!isGUICreated()) {
createGUI();
}
toggleGUI();
}