Help of map voting system

Recently I was finishing up a game that me and a few of my friends have been working on when he thought of a Map Voting idea. We have this free model, planning to edit it a bunch but… it doesn’t really do anything. The script works perfectly and the votes work, it picks random if its even and or if nobody votes.

The problem is that the actual script doesn’t spawn in the maps.

I wanted the script to replace a map, for example

If maps 1, 5, and 4 were chosen to be voted on and map 5 won, as soon as the voting ended, the map that was voted would get put into workspace, and whatever map you were on instantly gets put into the maps folder to be chosen again sometime.

I’m not a good scripter and know nothing of this. Most videos are outdated and don’t work, and the free models don’t help.

If someone could help me then that’d be amazing. Here’s the code:
image



I don’t think there is code in the script that spawns the map.
I am also not a good scripter, but maybe you could add an object value with the previous map as the value and make the script delete the the map in the object value. And for the map spawning in, maybe you could use the code from line 148 to get the map name, then you can do something where it finds the map name in the maps folder, and puts it in the workspace.

Edit: instead of taking the maps out of the folder you can just clone the map.