Something wrong with this modulescript and or localscript (Local obviously)

Module

local menu = script.Parent
local Load_Gui = {};

local Load_Gui = function (gui)	
	menu.Text = gui
		for i, v in pairs(menu[gui]) do
		i.Visible = false
	end
end

return Load_Gui;

Localscript

local module = require (script.Parent.menufunction);

script.Parent.InputBegan:Connect(function()
	module.Load_Gui("ImageLabel");
end)

Error
Players.MrGuyROBLOX.PlayerGui.Visuals Gui.menu.LocalScript:4: attempt to index function with ‘Load_Gui’

I need to fire the function on the modulescript but I get the error mentioned earlier. I kept looking back and forth between an example but i have given up looking by myself.

Did you print the first line of the module, which is after Load_Gui = {}, to see if it worked?

I suspect that the reason why it isn’t working is because you placed a variable outside of the table and return in the module script. Place the variable between the table and the return like you did with the function.

I think what you’re looking for is:
function Load_Gui.Load_Gui( gui )
or you can write it as:
Load_Gui.Load_Gui = function( gui )

1 Like