Module Script Doesn't Run At All: No Errors in Output

I have this module script (Interface) that controls GUI elements specifically. I have it placed in StarterGui>Interface

It doesn’t run at all, and results in no errors in the output window. I have tried commenting out the entire script and just adding a print to see if it would even print anything, and nothing prints.

Any reason why its not working?

Interface Module:

-- // Universal Grpahical User Interface Module
-- Not for Distribution/Public Use
-- Scripted by @aswdgsagdb

local modVersion = "V1.0"


local Interface = {}
-- // Cores (default/common functions)

function Interface.toggleFrame(element)
	element.Visible = not element.Visible
end

function Interface.openFrame(element)
	element.Visible = true
end

function Interface.closeFrame(element)
	element.Visible = true
end

function Interface.tweenFrame(element, visiblity)
	if visiblity == true then
		element.Visible = true
		-- add tween funct here
	end
	if visiblity == false then
		element.Visible = true
		-- add tween funct here
	end
end

function Interface.showElement(element)
	element.Visible = true
end

function Interface.hideElement(element)
	element.Visible = false
end

function Interface.showGUI(GUI)
	GUI.Enabled = true
end

function Interface.hideGUI(GUI)
	GUI.Enabled = false
end

-- // Additionals (varies to project)

-- StartUp
function Interface.startUp()
	-- add here
	-- show the start screen
end

-- TeamSelector
function Interface.updateTeamFocus()
	-- add here
	-- update the information of what team to join
end

-- GameStatus
function Interface.updateGameSchedule(update)
	-- add here
	-- change the textlabel of GameSchedule
end

function Interface.updateGameTime(update)
	-- add here
	-- change the textlabel of GameTime
end

-- MiniMenu
function Interface.switchListToMiniMenu(update)
	-- add here
	-- use tween to switch the leaderbaord with the mini-menu
end

-- PlayerList
function Interface.updateCurrentPlayers(updateInfo)
	-- add here
	-- compile list current players in server
	-- updateInfo is a TABLE of info
end

function Interface.updatePlayerFocus(updateInfo)
	-- add here
	-- show selected player info
	-- updateInfo is a TABLE of info
end

-- Crafting
function Interface.updateCraftingList(updateInfo)
	-- add here
	-- compile list of craftable items and if its currently craftable by player
	-- updateInfo is a TABLE of info
end

function Interface.updateCraftingFocus(updateInfo)
	-- add here
	-- show selected crafting info
	-- updateInfo is a TABLE of info
end

-- PlayerStatus
function Interface.playerStatusesUpdated()
	-- add here
	-- show bars briefly
end

function Interface.updateHealth(update)
	-- add here
	-- tween bar
end

function Interface.updateStamina(update)
	-- add here
	-- tween bar
end

warn("Graphical User Interface " .. modVersion .. " Successfully Loaded.")

return Interface

Are you ever requiring it? It won’t run unless it’s been required

1 Like

Make sure your requiring it on the client and using it correctly, Otherwise, provide the localScript using this.

I indeed am, but when doing so, it results in Interface is not a valid member of PlayerGui "Players.aswdgsagdb.PlayerGui"

It is called “Interface” and not “interface” or “InterFace” right?

Well there’s your issue, you need to be using playerGui:WaitForChild(‘Interface’). It doesn’t exist at the time you’re trying to index it, causing that error.

If it breaks sometimes, it’s probably because your player gui is being reset. You could try putting the module inside of a screenGui and then turning ResetOnSpawn for the ScreenGui off, then indexing it that way

1 Like
-- Created for ~~~~~~~~~~~
-- Scripted by @aswdgsagdb

local lsVersion = "V1.0" 
local Interface = require(game.Players.LocalPlayer.PlayerGui.Interface)

This is pretty much all you need, theres nothing else calling this.

And yes: its named exactly Interface

Funny how I tried this as soon as this happened and it then it still didn’t work, but now it does. Thanks.

And yes, I have used WaitForChild before and I know how it works and why we use it, its because some things load before or later.

EDIT: I’ve done that method of using a ScreenGui, and I might try it in the future again if errors are present.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.