I’m trying to require a module but for some reason I’m getting this error:
Requested module experienced an error while loading - Client - ChangeText:4
Stack Begin - Studio
Script 'Players.calvin_coco.PlayerGui.ScreenGui.LevelCounter.ChangeText', Line 4 - Studio -
ChangeText:4
Stack End - Studio
This is how I require the module,
local Module = require(Storage.MainModule)
Anyone know how to fix? (Also, restarting studio didn’t work and I don’t have Luau)
Edit: Oops, forgot to put the modulescript code
local Storage = script.Parent
local Level = workspace.Level
local module = {}
local currentLevel = script.Parent.StartLevel.Value - 1
function module.nextLevel(func:any)
if func and typeof(func) == 'function' then
currentLevel += 1
if Storage.Levels:FindFirstChild('L' .. currentLevel) then
local Folder = Storage.Levels['L' .. currentLevel]
Level:ClearAllChildren()
for _, C in Folder:GetChildren() do
C:Clone().Parent = Level
task.wait()
end
func()
end
end
end
function module:getLevel()
return currentLevel
end
return module