You could save the map as a model or list/folder of models in ServerStorage, let the game destroy the current one, then clone the fresh map back into workspace.
Because you are still learning programming, the Onboarding experience might be something you want to take a look at. It has plenty of tutorials for learning Roblox’s development platform and game engine.
Here’s a simple function that can unload the current map and load a new one map, although it’s untested so it may not work. It may have anything from a minor typo to a major overlook or flaw. Also, if you don’t understand how parts of it work that is okay. You will just have to learn enough to understand what it’s doing. You can check out the Onboarding experience like I mentioned or find tutorials on youtube. If you want to use youtube tutorials, I recommend AlvinBlox or TheDevKing, as I’ve found each to be most useful in the past while I was still learning. I’ll also provide some youtube videos at the bottom of this reply.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local function anchorCharacters(anchor, list)
for _, player in pairs(Players:GetPlayers()) do
local character = player.Character
if character then
if list then
table.insert(list, character)
end
character.PrimaryPart.Anchored = anchor
end
end
end
local function loadMap(map)
local blacklist = {}
anchorCharacters(true, blacklist)
for _, child in pairs(workspace:GetChildren()) do -- if you don't want to filter the children then you can just use Instance:ClearAllChildren
if not table.find(blacklist, child) then
child:Destroy()
end
end
map:Clone().Parent = workspace
anchorCharacters(false)
end
Note: Keep in mind that the map variable should be a Folder containing everything you want to be in the map be default. Also, the folder containing the map should be placed in ReplicatedStorage.
Note2: if you don’t want to filter the children then you can just use Instance:ClearAllChildren instead of the for loop in the loadMap function.
This last one is just Roblox tutorials in general.