I was trying to make a module script that I could use to control an intermission text bar.
This code is intended to change the visibility of the text bar:
function module.visible(bool) local intermissionGUI = script.Parent local intermissionText = intermissionGUI:WaitForChild("TextLabel") if bool == true then intermissionText.Visible = true elseif bool == false then intermissionText.Visibile = false else warn("Invalid parameter!") end end
I tried running the visible() function using the following script:
local gui = require(game.ServerStorage:WaitForChild("InterGUI")) gui:visible(false)
But the ModuleScript just prints out "Invalid parameter!"
Any help will be appreciated!
the problem is how your calling the function, when you define a function as module.method()
and call the function via module:method
, the first argument passed to the method is the object (module).. so just do module.visible(true)
, or otherwise define the method with the colon operator -> module:visible()