When you find yourself doing this, you should try making a function. They are very useful for this kind of thing. In this case, you could try:
--! Note: This is untested. !
local CurrentMap = nil --Nil, meaning nothing: no current map yet
local NewMap = function(NewMapModel) --Note: NewMapModel is a value representing what you pass to the function when its ran. See below.
if CurrentMap~=nil then --If theres a CurrentMap
local msg = Instance.new("Hint")
msg.Parent = game.Workspace
msg.Text = "Changing Map..." --Note: You don't need parenthesis here
wait(4)
msg:Destroy() --Note: remove() is deprecated (no longer used), Destroy() is used now
CurrentMap:Destroy() --Destroy it
end
wait(1)
CurrentMap = NewMapModel:Clone()
CurrentMap.Parent = game.Workspace
end
while true do
--The way you run a function is by typing its name followed by open and closing parenthesis. We will pass one argument inside of these parenthesis, which will become NewMapModel inside of the function, and the code inside of the function will be ran each time.
NewMap(game.Lighting.AdSpace) --Here NewMapModel = game.Lighting.AdSpace
wait(60)
NewMap(game.Lighting.TinyBasalt) --Here NewMapModel = game.Lighting.TinyBasalt
wait(60)
NewMap(game.Lighting.spawnstrip) --Etc.
wait(60)
NewMap(game.Lighting.SST)
wait(60)
end |