Hi, I’m making an admin panel called VisionHub v2 and I’m having issues with the command system, the system works of a GUI based interface and commands are ran through a frame that hold arguments that apply to the command at hand.
I’m trying to achieve a function based module system, where the commands are ran though individual module scripts, and the commands are loaded in the panel.
My issue is that when i run the command submit function, its running one more time each time, screenshots below to better understand:
In the first screen shot, I click the kill button once and submitted once, it worked normally,
In the second i had clicked the kill button twice (INCLUDING THE FIRST TIME) and it ran the command twice
Screenshots
The Issue
Command Button Clicked Once And Submitted Once: (Output)
It’s likely due to the code possibly creating the SubmitButton MouseButton1Click event multiple times.
What I would recommend is having 2 variables to store the MouseButton1Click for both the CancelButton and the SubmitButton. When you call the LoadArguments function, it checks if the variables aren’t nil and if so it disconnects the events and sets the variables to nil before it continues to overwriting the variables with new events for the command