So I have a module script with a lot of common variables and functions and I also have a local script which uses those functions, but when I call a function from the module script, it throws up an error.
Module Script:
local CommonResources = {}
CommonResources.Frame = script.Parent.Parent.Frame
CommonResources.Main = script.Parent.Parent.Frame.Main
CommonResources.Welcome = script.Parent.Parent.Frame.Welcome
CommonResources.Battery = script.Parent.Parent.Data.PerSession.Battery
CommonResources.SessionStarted = script.Parent.Parent.Data.PerSession.SessionStarted
function HideFrame(Frame)
Frame.Visible = false
Frame.Active = false
end
function ShowFrame(Frame)
Frame.Visible = true
Frame.Active = true
end
return CommonResources
Local Script:
local CommonResources = require(script.Parent.CommonResources)
local Main = CommonResources.Main
local Welcome = CommonResources.Welcome
local Frame = CommonResources.Frame
local Battery = CommonResources.Battery
local SessionStarted = CommonResources.SessionStarted
CommonResources.HideFrame(Main)
CommonResources.ShowFrame(Welcome)
CommonResources.ShowFrame(Frame)
CommonResources.SetZIndex(Frame, 1)
CommonResources.SetZIndex(Main, 2)
CommonResources.SetZIndex(Welcome, 3)
Battery.Value = 100
SessionStarted.Value = false
Error:
Scripts.SetDefaults:8: attempt to call a nil value
