SOLVED | Changing values of a GUI element from another script

Hello! As I’m co-developing this project and starting to get the hand on how Lua works and its quirks I still have my headscratching moments.

So the project has a “Pause function” that is a function on a .script file, but I have some GUI elements that I want to enable or disable as this function is active or deactivated.

I do know that GUI elements need to be in a .gui_script for them to be able to work. So I made two functions in a .gui_script that pretty much say what I want to do.

image

Is there a way to call these functions from one script to the other? Or should I try to implement the code of the pause fuction in my .gui_script?

One way would be to send a message to the .gui script, then receive it in the on_message() function and trigger the respective function.

3 Likes

This was actually what I had to do!

Create a msg.post on the .script and then catch it on the .gui_script with on_message function. Thank you!

3 Likes