I’m creating a game right now, but i need to make a script that restores the map every 5 minutes because its a game where u destroy the map, anybody able to go into studio on my game and make it?
So 5 minute map restoration?
Alright let me write you a code for it
local ContentProvider = game:GetService("ContentProvider") local assets = workspace:GetChildren() ContentProvider:PreloadAsync(assets) --Waiting for game to load local MapCopy = workspace:GetChildren() --idk just do it again while true do wait(60) --Below is to delete the current map and not delete the camera or anything for _, v in ipairs(workspace:GetChildren()) do game:GetService("RunService").Heartbeat:Wait() --Prevent crashing if v.ClassName ~= "Camera" and v.ClassName ~= "Terrain" then v:Destroy() end end MapCopy:Clone().Parent = workspace --Finally cloning it end
Not sure if that works since I did not test and I just wrote it on the spot.
Alright I’ll write up a file and send the rblx file here.
Reload.rbxl (18.3 KB)
Basically the script would be found in ServerScriptService
Note: Parts that have the Propery Locked on true will not get cloned.
A little bit wait(5) a little amount while true do and a little math.random() then its all done
Bruh… it removed the whole map ingame
Isn’t it what you need?
It deletes the current and replaces it with the same one
What i meant is you join the game, start destroying the map since its the point of the game, then after 5 minutes, the script u made is suppose to make everything reload for they can redestroy it, like imagine destroying a building with a rocket, after 5 minutes the building will reload into a fixed building for u can destroy it, but except its reloading everything except the platform in my game for they can redestroy it if they already destroyed everything
Thats what i meant
Viken’s script from how I have been following on, will replace the broken or destroyed building, this means it will have to destroy the broken one, and create a new one. Try change some groups around and tweak the script if you want it to only do certain parts inside a group etc.
But right whem i joined the game, the whole map was deleted
My bad, my code is buggy, I’ll work on improving it.
I tried a few things but I couldn’t figure out a better way than my current script.
Another thing you could do is have a map copy in ServerStorage and clone from there to workspace.
Closed due to issue being fixed.