hi, im trying to make a map change script for my game but all the tutorials i see have a intermission in them. one way i think you can do this is by having all the maps except the starting map in Lighting and having the other map already in Workspace. then after 300 seconds (5 minutes) the map goes into Lighting and the next map moves into Workspace and the process continues. i also need to make sure the script repeats itself over and over. also when the map changes i need to have it kill all the players
here is what i thought could be quite close:
wait(300) Map1.Parent = "Lighting" Map2.Parent = "Workspace" Players"Humanoid".Health = 0
i know thats probably way off, thanks in advance from poopypigeon245
This is fairly simple, what you would need to do is make a while true do loop in serverscriptservice as your main script. That would look something like this:
--// Variables TimePerMap = 300 --// Map Changing while wait(TimePerMap) do if workspace.MapStorage:FindFirstChild("Map1") then workspace.MapStorage.Map1.Parent = Lighting mapClone = game.Lighting.Map2:Clone(workspace.MapStorage) mapClone.Name = "Map2" end end
keep repeating that if statement but change it to map2, map3, map4, etc. going up to the number of maps you have, but on the last one, change it back to map1. You can also change the variable to however many seconds you want the map to be out. Hope I helped.
EDIT: you would need to make the copies of those lines say workspace.MapStorage:ClearAllChildren() instead of setting their parent back to workspace, the reason for this is that the server would have way too many objects in lighting and lag out the game due to the fact that we are putting a clone in lighting, not the original map.