Hello , I wanted to make it so I can acess the settings from the settings modules In my maps but I tried everything and can’t make it work! the Idea is each time there is a new map the script will take the settings and apply them to the game exemple the wait time will be changed from maps to maps and the ambience too the lighting etc , I tried to acess it but I get the error message :[ Attempted to call require with invalid argument(s). Line 28 ] the Maps are in ServerStorage In a Map Folder and the Main script In workspace.
local mp = game.ServerStorage.MapFolder
local SPY = game.Workspace.SoundPlayer
local MapsTable = {
mp.Base ,mp.Volcano ,mp.Spooky ,mp.SpecialPart ,mp.Internet
}
local SoundTable = {
SPY.Err
}
local lastMap = script.LastFloorNbre
local CMap = script.CuFloorNbre
local AMP = game.Workspace.ActiveMaps
--local SettingModule = require(MPSettings)
-----------------------------------------------------------------------------Main
while true do
chose = math.random(1,#MapsTable)
if chose == lastMap.Value then
print("no")
wait()
else if chose ~= lastMap.Value then
local MYmodule = mp:FindFirstChild(MapsTable[chose].MPSettings)
local MPSB = require(MYmodule)
print(MPSB.TimeToWait)
wait(0.25)
print(chose)
print(MapsTable[chose])
--nameofthemap = MapsTable[chose]
mp:FindFirstChild(MapsTable[chose].Name):Clone().Parent = game.Workspace.ActiveMaps
wait(0.25)
AMP:FindFirstChild(MapsTable[chose].Name):Destroy()
lastMap.Value = chose
end
end
SPY.Err:Play()
wait()
print("loop")
end
The built-in function named “require” expects a string value to be passed as the first argument to it, with that string value pointing towards the name of the ModuleScript being imported.