Anyone know why my module script isn’t working??
Module:
local level = {
["1"] = {
["People"] = 4,
["Clones"] = 2,
["CloneType"] = "Random",
["SpawnType"] = "Spawn",
["Walking"] = false,
["Stage"] = "Crosswalk"
}
}
return level
LocalScript
function setthestage()
local level = game.Workspace.GlobalVars.CurLevel
local levelmod = require(game.ReplicatedStorage.Levels)
peopleamount = levelmod[level]["People"]
cloneamount = levelmod[level]["Clones"]
spawntype = levelmod[level]["SpawnType"]
clonetype = levelmod[level]["CloneType"]
maptype = levelmod[level]["Stage"]
end
You’re saying:
local level = game.Workspace.GlobalVars.CurLevel
I think you forgot to put .Value
behind CurLevel
I did notice that and changed the script to reflect that
function setthestage()
local level = game.Workspace.GlobalVars.CurLevel.Value
local levelmod = require(game.ReplicatedStorage.Levels)
peopleamount = levelmod[level]["People"]
cloneamount = levelmod[level]["Clones"]
spawntype = levelmod[level]["SpawnType"]
clonetype = levelmod[level]["CloneType"]
maptype = levelmod[level]["Stage"]
end
But it still returns the same error.
Perhaps you can share the error, it would certainly help.
I think I’ve found the issue. I am assuming you’re using either a numberValue or an intValue for the CurLevel instance. However, you have listed your data as a stringValue ("1"
, not 1
). You can try if the code works by just replacing the “1” in your modulescript with 1.
1 Like
system
(system)
Closed
September 30, 2023, 12:28pm
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.