How to I change UI visibility in a module script?

I’m trying to make an inventory script that loads in when the player presses Q. In PlayerScripts, I have the input module and the inventory module checking for the Q key and toggling visibility for the inventory, along with adding the items. However, I can’t see the inventory change visibility on screen. I know the module script works, as it can delete frames off of the inventory, and I know it does change visibility because when I debug the script the visibility returns as true in output.

I tested out putting a simple local script that toggled the visibility when the player pressed Q and it worked. However, I need it to be a module script, as the structure of my game depends on modules to make everything work nicely.

How do I make the module work?

As long as the function in the module is getting passed the correct UI object, it should work. Make sure you are passing the correct UI object, and toggling the correct setting.

For UI containers like ScreenGui, the property is Enabled. For objects, its Visible.

1 Like

Okay, I changed the script to enable/disable the screenGUI instead and it seems to work