i made a script that spawns a new map when the level is complete but its not working.
script:
local buttons = game.ServerStorage:WaitForChild("Folder"):WaitForChild("Buttons") -- i have an int value called Buttons
if buttons.Value <= 0 then --everytime they collect a generator it brings button value down. when they collected all generators its 0
print("DO SOMETHING") --its not printing this
game.ServerStorage:WaitForChild("Floor"):WaitForChild("FloorLv").Value = game.ServerStorage:WaitForChild("Floor"):WaitForChild("FloorLv").Value + 1
--the int value adds 1 to FloorLv so i can show the player what floor there on
local FloorType = math.random(1,2)
print(FloorType) --not printing
local WoodHallsMap = game.ServerStorage.WoodHallsMap:Clone() --cloning a model of map i put in Server storage
local MapOldFacility = game.ServerStorage.MapOldFacility:Clone() --cloning a model of 2nd map i put in Server storage
if FloorType == 1 then
WoodHallsMap.Parent = game.Workspace --sets the clone parent to workspace so its visible
warn("Loading Map Wood Halls Success")
elseif FloorType == 2 then
MapOldFacility.Parent = game.Workspace --sets the clone parent to workspace so its visible
warn("Loading Map Old Facility Success")
end
end
wait(3)
warn("Load complete")
if the script does suffice heres the model:
Map models: Put me inside ServerStorage - Roblox
Scripts: Put me in serverscriptservice - Roblox
Button to decrease generator int value: Click me to decrease generator level - Roblox