script.Parent.Touched:connect(function() wait(1) for i,v in pairs(game.ServerStorage:GetChildren()) do if string.lower(v.Name) == "level2" then v.Parent = Workspace end end for i,v in pairs(game.Workspace:GetChildren()) do if string.lower(v.Name) == "level1" then v.Parent = ServerStorage end end end)
This is suppose to change the map when the brick is touched but wont work..
See what prints.
local db = true local map1 = "level1" local map2 = "level2" local storage = game:GetService("ServerStorage") if storage:findFirstChild(map1) and storage:findFirstChild(map2) then print("Both are there") else print("One or both of those is nil") return end script.Parent.Touched:connect(function(hit) if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) and db then db = false for i,v in pairs(storage:GetChildren()) do if v.Name:lower() == map2 then v.Parent = Workspace end end for i,v in pairs(Workspace:GetChildren()) do if v.Name:lower() == map1 then v.Parent = storage -- You had an error here. end end db = true end end)
Did you check the output window?