I made a game based off roblox capture the flag template.The game involve explosions that create holes in the map,so what can I do to make the map reset after the match end ?
When the match ends, find the map in the workspace (maybe organize it under a Folder or Model.) Then when the match ends, loop through said folder and destroy everything in it.
Some useful articles:
Ok thank you just another question,how can I modify the timestamp so a match can last longer ?
Would you mind if I saw your time stamp?
There’s a tutorial at the bottom of the region 3 post that explains how to create terrain Region3 | Documentation - Roblox Creator Hub
Code from that article
local region = Region3.new(Vector3.new(0, 0, -3), Vector3.new(4, 4, 4))
region = region:ExpandToGrid(4)
workspace:WaitForChild("Terrain"):FillRegion(region, 4, Enum.Material.Water)
the match last 4 minutes for default but i made the game much more difficult so it have to las at least 20 minutes
-
I misread your post. I thought you were just asking about how to destroy a map. @kingerman88 provided a very good link about terrain editing. Please mark it as the solution.
-
If you’re making a countdown, you probably have a value for how many seconds or minutes the round lasts. If this isn’t the case, please post your script so we can help you.
yes I’m sorry but i also asked this because i need it and i rembered it just now
I looked through the template and found where you can adjust the time.
There is a script called “Configurations”. It holds how long each intermission and round is for. The first variable, ROUND_DURATION, is what you’re looking for. Change the first digit to whatever you’d like.
(to find ROUND_DURATION, do Ctrl + Shift + F
to bring up a Search All Scripts menu and type in ROUND_DURATION.)
thank you,I’m sorry ,it is my fault that sometimes I don’t explain things very well,but a the start I didnt wanted to destroy a map but to set an automatic reset after the match ending
Please create a new thread for a new problem and search first or try editing the code yourself before posting threads or questions to the forums. These are questions that can be answered if you play around a little or think of how to logically approach the problem.
A map’s contents can be refreshed if you keep them in a model or folder and parent them to a storage service. At the start of a round, copy them to the workspace so that the map has the default parts that usually come with a map. At the end of a round, destroy the map parts copy in the workspace. When a new round starts, this process repeats itself, thus a fresh copy of all the map’s parts.
For terrain, you’ll need to go a little further by saving the terrain data and pasting it back whenever a new round begins. It’s the same idea as the map parts though. It doesn’t necessarily have to be at the beginning of the round but somewhere in your code you might have this:
local terrainMap = workspace.Terrain:CopyRegion(workspace.Terrain.MaxExtents)
terrainMap.Name = "DefaultTerrain"
terrainMap.Parent = game:GetService("ServerStorage")
Then preferably at the start of the round, you’d paste that terrain back and overwrite other terrain cells such that you have the original map without the damage taken from explosions or any other feature that can modify cells in your game.
local defaultTerrain = game:GetService("ServerStorage").DefaultTerrain
workspace.Terrain:PasteRegion(defaultTerrain, workspace.Terrain.MaxExtents.Min, true)
As far as modifying the time goes, just look through the code, find where the game time value is configured and edit it there. You should attempt things first before asking here on the forums.