I've created a button that all players can use that regenerates the game map ("GameModel" in workspace). I can't figure out why it only works the first time it's pressed. I have a remote event named MapRegen in replicated storage. I also have a local script in the button -
local button = script.Parent
local function onButtonActivated()
game.ReplicatedStorage.MapRegen:FireServer()
print("Server notified")
end
button.Activated:Connect(onButtonActivated)
And script in server script service -
local oldmap = game.Workspace:WaitForChild("GameModel")
local newmap = game.ServerStorage:WaitForChild("GameModel"):Clone()
game.ReplicatedStorage.MapRegen.OnServerEvent:Connect(function(player)
oldmap:ClearAllChildren()
oldmap:Destroy()
print("map destroyed")
wait(.5)
newmap.Parent = game.Workspace
print("Map regen")
end)
Help would be much appreciated!

2 comments
I believe you are deleting the original. then
newmaphas nothing to clone, try adding a unique name to the specific clone.I could be wrong but it might be enough for you to spot something