[SOLVED] I need a script to reset the entire workspace

please try my last solution, it should work by now.

can you give me your script? first and second part? ill try it now

i was replying to mooran, you can see i replied to him

alright, here you go:

-- create a folder before startup that stores everything from the workspace
local folder = Instance.new('Folder', game.ServerStorage)
folder.Name = 'CopiedMap'

for i, v in ipairs(workspace:GetChildren()) do
	if v.Name == 'Terrain' or v.Name == 'Camera' or game.Players:GetPlayerFromCharacter(v) then continue end
	local cloned = v:Clone()
	cloned.Parent = folder
end

-- (second script)
local copiedMap = game.ServerStorage:FindFirstChild('CopiedMap')

if copiedMap then
	print('running')
	for i, v in ipairs(workspace:GetChildren()) do
		if v.Name == 'Terrain' or v.Name == 'Camera' or game.Players:GetPlayerFromCharacter(v) then continue end
		print('destroy')
		v:Destroy()
	end
	task.wait(3) -- wait for a bit before it clones everything back into workspace..
	for i, v in ipairs(copiedMap:GetChildren()) do
		v.Parent = workspace
	end
else
	print(copiedMap)
end

those scripts destroy the map as soon as the game starts

Read better you was replying to me, the last Script is working hayde yallah olm

1 Like

well it works perfectly fine for me, can you show me how you’ve structured it in both parts?

image


wait hold on, its not destroying itself anymore

nope i was wrong, it did it again

i think its rare occurrence for it not to destroy itself

Vallah bist peinlich HAHA


@mroaan heres a picure of the output
dont worry about the values, they were connected to infinite loops and they were destroyed by the scripts

the script reloader destroys everything in the workspace, then it waits for a couple of seconds before it reloads it

it didnt do thatchar limit

it runs into an error, its in the middle of the image above

its at 07:53:31.413

char limit

First learn to script before you are writing something oruspu peinlich vallah

i kind of do already, just not very good

all i know is enough for my core game

i kind of want it to work like this

at server startup, save the entire workspace in a Folder to ServerStorage

when i want to reset the map, delete all the children of Workspace and clone everything in the Folder to Workspace

i exited studio, im gonna take a break from replying for now, we’re at 89 posts including this one