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

heres a first look image at the entire explorer tab (everything inside of explorer, including all children i want reset)

this is for my core game, and i want the map to reset after for example, core explosion or shutdown


Tell me if you need to open anything and show the childs, i will provide images

The Map Folder is the folder that contains basically the entire map, but it does not contain everything, for example. CoreLasers or the startup and shutdown buttons. This is why i need the entire game, including workspace and everything else thats circled to reset:


i also need scripts reset back to when the game was first ran, this also applies to everything else

heres an artists diagram of how the game works (includes future and not yet added events)


The main event im working on right now is Startup Failure Event which is why i need the reset script, so i can reset the map after the explosion

i will be testing this in an ordinary part, but the finished product will be inserted into a script. heres that script (it starts up the core, with the failure chance):

function onClicked()
	local Randomizer = math.random(1, 1)
	if Randomizer == 1 then
		print("Startup will fail")
		script.Parent.Buttons.Main_Power_Button.Sound:Play()
		script.Parent.Buttons.Main_Power_Button.PrismaticConstraint.TargetPosition = 0.1
		wait(0.3)
		script.Parent.Buttons.Lock_Indicator.BrickColor = BrickColor.new("Really black")
		script.Parent.Buttons.Main_Power_Button.PrismaticConstraint.TargetPosition = 0
		script.Parent.Buttons.Main.Sound:Play()
		script.Parent.Buttons.Main.HingeConstraint.TargetAngle = 0
		script.Parent.Buttons.Main_Power_Button.ClickDetector.MaxActivationDistance = 0
		script.Parent.Third.Disabled = true

		print("Startup button pressed, beginning startup script")
		local AnnouncerBeep = workspace.Sounds.BAlarm
		local TweenService = game:GetService("TweenService")
		wait(0.5)
		AnnouncerBeep:Play()
		local ReactorSealOpen = TweenService:Create(workspace.Map.ReactorSeal, TweenInfo.new(6, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {Position = Vector3.new(-557.704, 698.454, 253.196)})
		local ReactorSealClose = TweenService:Create(workspace.Map.ReactorSeal, TweenInfo.new(6, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {Position = Vector3.new(-557.704, 663.624, 253.196)})
		wait(1)
		workspace.AnnouncerMessages.StartupMessages.Message1:Play()
		wait(7)
		ReactorSealOpen:Play()
		workspace.Sounds.DoorMoving:Play()
		wait(6)
		workspace.Sounds.StartupMusic:Play()
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0
		wait(2)
		AnnouncerBeep:Play()
		local LasersCharge = TweenService:Create(workspace.Values.LaserLightsUpperValue, TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Value = Color3.new(1,1,1)})
		local StabLasersCharge = TweenService:Create(workspace.Values.StabLasersUpperValue, TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Value = Color3.new(0,1,1)})
		workspace.Sounds.LaserChargeUp:Play()
		LasersCharge:Play()
		StabLasersCharge:Play()
		wait(1)
		workspace.AnnouncerMessages.StartupMessages.Message2:Play()
		wait(7.5)
		workspace.Values.FacilityLightsColor.Value = Color3.new(0.0941176, 0.0941176, 0.0941176)
		workspace.Sounds.LightsOff:Play()
		wait(1.5)
		workspace.Values.ReactorChamberLightsColor.Value = Color3.new(1, 1, 1)
		workspace.Sounds.LightsOn:Play()
		wait(1)
		AnnouncerBeep:Play()
		wait(1)
		workspace.AnnouncerMessages.Success:Play()
		wait(1)
		workspace.AnnouncerMessages.StartupMessages.Message3:Play()
		wait(3.5)
		workspace.Values.ShieldCreationBeamValue.Value = true
		local FieldAppear = TweenService:Create(workspace.CoreForceField, TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {Transparency = 0})
		FieldAppear:Play()
		wait(5)
		AnnouncerBeep:Play()
		wait(1)
		workspace.AnnouncerMessages.Success:Play()
		wait(1)
		workspace.AnnouncerMessages.StartupMessages.Message4:Play()
		wait(6)
		AnnouncerBeep:Play()
		wait(1)
		workspace.Values.CoreLineAuraValue.Value = true
		workspace.AnnouncerMessages.StartupMessages.Message5:Play()
		wait(5)
		workspace.Values.ShieldCreationBeamValue.Value = false
		wait(0.5)
		workspace.CoreLasers.CoreLaser1.Cone.Attachment.Beam.Enabled = true
		workspace.CoreLasers.CoreLaser2.Cone.Attachment.Beam.Enabled = true
		workspace.CoreLasers.CoreLaser3.Cone.Attachment.Beam.Enabled = true
		workspace.CoreLasers.CoreLaser4.Cone.Attachment.Beam.Enabled = true
		workspace.CoreLasers.CoreLaser5.Cone.Attachment.Beam.Enabled = true
		workspace.CoreLasers.CoreLaser6.Cone.Attachment.Beam.Enabled = true
		workspace.CoreLasers.CoreLaser7.Cone.Attachment.Beam.Enabled = true
		workspace.CoreLasers.CoreLaser8.Cone.Attachment.Beam.Enabled = true
		local StartupShockwave = TweenService:Create(workspace.Shockwave, TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0), {Size = Vector3.new(200, 200, 200), Transparency = 1})
		local CoreAppear = TweenService:Create(workspace.Core, TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Transparency = 0})
		local CoreVFXraise = TweenService:Create(workspace.Sounds.CoreVFX, TweenInfo.new(8, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {PlaybackSpeed = 4})
		local ShieldRedify = TweenService:Create(workspace.CoreForceField, TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Color = Color3.new(1, 0, 0)})
		ShieldRedify:Play()
		CoreVFXraise:Play()
		CoreAppear:Play()
		StartupShockwave:Play()
		workspace.Core.StartupEmitter.StartParticles.Enabled = true
		workspace.Core.StartupEmitter.StartAura.Enabled = true
		workspace.Sounds.Shockwave:Play()
		wait(3)
		workspace.Sounds.Elec:Play()
		workspace.Core.CoreEffects.Fire1.Enabled = true
		workspace.CoreForceField.Transparency = 1
		wait(2)
		workspace.Sounds.StartupMusic:Pause()
		workspace.Sounds.StartupFailMusic:Play()
		wait(0.2)
		workspace.Values.ReactorChamberLightsColor.Value = Color3.new(0,0,0)
		wait(0.2)
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1,0,0)
		workspace.Values.ReactorChamberLightsColor.Value = Color3.new(1,0,0)
		workspace.Sounds.LightsOn:Play()
		AnnouncerBeep:Play()
		wait(1)
		local CoreVFXSlowRaise = TweenService:Create(workspace.Sounds.CoreVFX, TweenInfo.new(120, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {PlaybackSpeed = 10})
		CoreVFXSlowRaise:Play()
		workspace.AnnouncerMessages.StartupMessages.StartupFailMessages.Message1:Play()
		workspace.Core.StartupEmitter.StartAura.Enabled = false
		wait(10)
		AnnouncerBeep:Play()
		wait(1)
		workspace.AnnouncerMessages.StartupMessages.StartupFailMessages.Message2:Play()
		local RandomStab = math.random(2, 2)
		wait(11)
		if RandomStab == 1 then
			wait(3)
			local PlaybackSlow = TweenService:Create(workspace.Sounds.CoreVFX, TweenInfo.new(6, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {PlaybackSpeed = 1})
			CoreVFXSlowRaise:Pause()
			PlaybackSlow:Play()
			workspace.Sounds.StartupFailMusic:Pause()
			wait(6)
			AnnouncerBeep:Play()
			wait(1)
			workspace.AnnouncerMessages.StartupMessages.StartupFailMessages.Message3:Play()
			workspace.Values.ReactorChamberLightsColor.Value = Color3.new(0,0,0)
			wait(0.2)
			workspace.Sounds.LightsOn:Play()
			workspace.Values.LaserLightsControlValue.Value = Color3.new(0,0,0)
			workspace.Values.ReactorChamberLightsColor.Value = Color3.new(1,1,1)
			workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
			workspace.Sounds.StartupMusic.Playing = true
			wait(16)
			workspace.AnnouncerMessages.StartupMessages.Message3:Play()
			workspace.CoreForceField.Color = Color3.new(1,1,1)
			local FieldAppear = TweenService:Create(workspace.CoreForceField, TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {Transparency = 0})
			FieldAppear:Play()
			wait(6)
			AnnouncerBeep:Play()
			wait(1)
			workspace.AnnouncerMessages.Success:Play()
			wait(1)
			workspace.AnnouncerMessages.StartupMessages.Message7:Play()
			wait(14)
			AnnouncerBeep:Play()
			wait(1)
			workspace.AnnouncerMessages.StartupMessages.Message8:Play()
			wait(4)
			workspace.Values.ReactorChamberLightsColor.Value = Color3.new(0,0,0)
			workspace.Sounds.LightsOff:Play()
			wait(1)
			workspace.Values.ReactorChamberLightsColor.Value = Color3.new(1,1,1)
			workspace.Values.FacilityLightsColor.Value = Color3.new(1,1,1)
			workspace.Sounds.LightsOn:Play()
			workspace.Values.LaserLightsControlValue.Value = Color3.new(0,1,0)
			wait(1)
			AnnouncerBeep:Play()
			wait(1)
			workspace.AnnouncerMessages.StartupMessages.Message9:Play()
			wait(5)
			local FuelIndicatorOff = TweenService:Create(workspace.Values.LaserLightsUpperValue, TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {Value = Color3.new(0,0,0)})
			FuelIndicatorOff:Play()

			workspace.Core.StartupEmitter.ParticleEmitter.Enabled = false
		else
			wait(3)
			AnnouncerBeep:Play()
			wait(1)
			workspace.AnnouncerMessages.StartupMessages.StartupFailMessages.Message3b:Play()
			coroutine.wrap(function()
				while true do
					local basePart = workspace.Base
					local corePart = workspace.Core
					local coreEffects = workspace.Core.CoreEffects
					local startupemitter = workspace.Core.StartupEmitter

					-- Calculate the random x, y, z coordinates
					local randomX = math.random(-7, 7)
					local randomY = math.random(-7, 7)
					local randomZ = math.random(-7, 7)

					-- Create a random position Vector3 using the coordinates
					local randomPosition = Vector3.new(randomX, randomY, randomZ)

					-- Tween the part to the new position
					TweenService:Create(corePart, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Position = randomPosition + basePart.Position}):Play()
					TweenService:Create(coreEffects, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Position = randomPosition + basePart.Position}):Play()
					TweenService:Create(startupemitter, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Position = randomPosition + basePart.Position}):Play()

					-- Wait one second
					wait(1)
				end
			end)()
			for i = 1, 2 do
				local CoreLaserNumber = math.random(1, 8)
				local CoreLaser = workspace.CoreLasers["CoreLaser"..CoreLaserNumber]
				while CoreLaserNumber == 1 or CoreLaserNumber == 3 do
					CoreLaserNumber = math.random(1, 8)
					CoreLaser = workspace.CoreLasers["CoreLaser"..CoreLaserNumber]
				end
				local Fire = Instance.new("Fire")

				local Beam = Instance.new("Beam") 
				workspace.Sounds.MiniExplosion:Play()
				Beam.Texture = "http://www.roblox.com/asset/?id=7151778302"
				Beam.TextureSpeed = 5
				Beam.Width0 = 25
				Beam.Width1 = 25
				Beam.Color = ColorSequence.new(Color3.fromRGB(0, 255, 255))
				Beam.TextureMode = "Stretch"

				Beam.Attachment0 = workspace.Core.LasersAttachment
				Beam.Attachment1 = CoreLaser.Cone.Attachment
				Fire.Parent = CoreLaser.Cone.Attachment
				Beam.Parent = workspace
				Beam.Brightness = 25

				wait(0.25)
				Beam:Destroy()

				Fire.Heat = 50
				Fire.Size = 25

				CoreLaser.Cone.Attachment.Beam.Enabled = false
				wait(1.5)
			end
			wait(8)
			workspace.Sounds.Alarm:Play()
			wait(2)
			AnnouncerBeep:Play()
			wait(1)
			workspace.AnnouncerMessages.StartupMessages.StartupFailMessages.Message4:Play()
			wait(6)
			AnnouncerBeep:Play()
			wait(1)
			workspace.AnnouncerMessages.StartupMessages.StartupFailMessages.Message5:Play()
			workspace.Sounds.StartupFailMusic:Pause()
			workspace.Sounds.StartupFailMusic2:Play()
			wait(7)	
			workspace.Sounds.LightsOn:Play()
			workspace.Values.FacilityLightsColor.Value = Color3.new(1,0,0)
			wait(3)
			workspace.ShutdownButton.First.Enabled = true
			workspace.AnnouncerMessages.StartupMessages.StartupFailMessages.Message10:Play()
			local cd = workspace.ShutdownButton.Buttons.Main_Power_Button.ClickDetector

			local timeoutTime = 60

			local function didWork() -- if the randomizer worked
				print("Success")
			end

			local function didntWork() -- if it didnt work
				print("Failed")
			end

			local function onPressed() -- when it is pressed within time
				print("I just got pressed")
				local randNum = Random.new():NextInteger(1, 2)
				if randNum == 1 then
					didWork()
				else
					didntWork()
				end
			end

			local canWork = true
			local cdConn = cd.MouseClick:Connect(function() -- this is the pressed connection
				if canWork then
					onPressed()
				end
			end)

			local totaltime = 0
			local conn
			conn = game:GetService("RunService").Heartbeat:Connect(function(dt)
				totaltime += dt
				if totaltime >= timeoutTime then
					-- past time
					print("Timeout")
					canWork = false
					cdConn:Disconnect() -- dont allow any more presses
					conn:Disconnect() -- stop the loop
				end
			end)
				wait(8)
				workspace.Core.CoreEffects.Fire2.Enabled = true
				wait(4)
				AnnouncerBeep:Play()
				wait(1)
				workspace.AnnouncerMessages.StartupMessages.StartupFailMessages.Message6:Play()
				wait(7)
				workspace.Values.FireSupresValue.Value = true
				wait(5)
				AnnouncerBeep:Play()
				wait(1)
				workspace.AnnouncerMessages.StartupMessages.StartupFailMessages.Message7:Play()
				wait(8)
				AnnouncerBeep:Play()
				TweenService:Create(workspace.Core, TweenInfo.new(20, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {Size = Vector3.new(22, 22, 22)}):Play()
				TweenService:Create(workspace.Core.StartupEmitter, TweenInfo.new(20, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {Size = Vector3.new(22, 22, 22)}):Play()
				TweenService:Create(workspace.Core.CoreEffects, TweenInfo.new(20, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {Size = Vector3.new(22, 22, 22)}):Play()
				wait(1)
				workspace.AnnouncerMessages.StartupMessages.StartupFailMessages.Message8:Play()
				wait(14)
				AnnouncerBeep:Play()
				workspace.Values.FireSupresValue.Value = false
				wait(1)
				workspace.AnnouncerMessages.StartupMessages.StartupFailMessages.Message9:Play()
				wait(10)
			end
	else
		print("Startup will succeed")
		script.Parent.Buttons.Main_Power_Button.Sound:Play()
		script.Parent.Buttons.Main_Power_Button.PrismaticConstraint.TargetPosition = 0.1
		wait(0.3)
		script.Parent.Buttons.Lock_Indicator.BrickColor = BrickColor.new("Really black")
		script.Parent.Buttons.Main_Power_Button.PrismaticConstraint.TargetPosition = 0
		script.Parent.Buttons.Main.Sound:Play()
		script.Parent.Buttons.Main.HingeConstraint.TargetAngle = 0
		script.Parent.Buttons.Main_Power_Button.ClickDetector.MaxActivationDistance = 0
		script.Parent.Third.Disabled = true
		
		print("Startup button pressed, beginning startup script")
		local AnnouncerBeep = workspace.Sounds.BAlarm
		local TweenService = game:GetService("TweenService")
		wait(0.5)
		AnnouncerBeep:Play()
		local ReactorSealOpen = TweenService:Create(workspace.Map.ReactorSeal, TweenInfo.new(6, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {Position = Vector3.new(-557.784, 698.085, 243.53)})
		local ReactorSealClose = TweenService:Create(workspace.Map.ReactorSeal, TweenInfo.new(6, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {Position = Vector3.new(-557.784, 663.624, 243.53)})
		wait(1)
		workspace.AnnouncerMessages.StartupMessages.Message1:Play()
		wait(7)
		ReactorSealOpen:Play()
		workspace.Sounds.DoorMoving:Play()
		wait(6)
		workspace.Sounds.StartupMusic:Play()
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 1
		workspace.Values.LaserLightsControlValue.Value = Color3.new(1, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0.5
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0, 0, 0)
		wait(0.5)
		workspace.Sounds.Alarm2.PlaybackSpeed = 0
		wait(2)
		AnnouncerBeep:Play()
		local LasersCharge = TweenService:Create(workspace.Values.LaserLightsUpperValue, TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Value = Color3.new(1,1,1)})
		local StabLasersCharge = TweenService:Create(workspace.Values.StabLasersUpperValue, TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Value = Color3.new(0,1,1)})
		workspace.Sounds.LaserChargeUp:Play()
		LasersCharge:Play()
		StabLasersCharge:Play()
		wait(1)
		workspace.AnnouncerMessages.StartupMessages.Message2:Play()
		wait(7.5)
		workspace.Values.FacilityLightsColor.Value = Color3.new(0.0941176, 0.0941176, 0.0941176)
		workspace.Sounds.LightsOff:Play()
		wait(1.5)
		workspace.Values.ReactorChamberLightsColor.Value = Color3.new(1, 1, 1)
		workspace.Sounds.LightsOn:Play()
		wait(1)
		AnnouncerBeep:Play()
		wait(1)
		workspace.AnnouncerMessages.Success:Play()
		wait(1)
		workspace.AnnouncerMessages.StartupMessages.Message3:Play()
		wait(3.5)
		workspace.Values.ShieldCreationBeamValue.Value = true
		local FieldAppear = TweenService:Create(workspace.CoreForceField, TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0), {Transparency = 0})
		FieldAppear:Play()
		wait(5)
		AnnouncerBeep:Play()
		wait(1)
		workspace.AnnouncerMessages.Success:Play()
		wait(1)
		workspace.AnnouncerMessages.StartupMessages.Message4:Play()
		wait(6)
		AnnouncerBeep:Play()
		wait(1)
		workspace.Values.CoreLineAuraValue.Value = true
		workspace.AnnouncerMessages.StartupMessages.Message5:Play()
		wait(5)
		workspace.Values.ShieldCreationBeamValue.Value = false
		wait(0.5)
		workspace.CoreLasers.CoreLaser1.Cone.Attachment.Beam.Enabled = true
		workspace.CoreLasers.CoreLaser2.Cone.Attachment.Beam.Enabled = true
		workspace.CoreLasers.CoreLaser3.Cone.Attachment.Beam.Enabled = true
		workspace.CoreLasers.CoreLaser4.Cone.Attachment.Beam.Enabled = true
		workspace.CoreLasers.CoreLaser5.Cone.Attachment.Beam.Enabled = true
		workspace.CoreLasers.CoreLaser6.Cone.Attachment.Beam.Enabled = true
		workspace.CoreLasers.CoreLaser7.Cone.Attachment.Beam.Enabled = true
		workspace.CoreLasers.CoreLaser8.Cone.Attachment.Beam.Enabled = true
		local StartupShockwave = TweenService:Create(workspace.Shockwave, TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0), {Size = Vector3.new(112.454, 112.454, 112.454), Transparency = 1})
		local CoreAppear = TweenService:Create(workspace.Core, TweenInfo.new(8, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Transparency = 0})
		local CoreVFXraise = TweenService:Create(workspace.Sounds.CoreVFX, TweenInfo.new(8, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {PlaybackSpeed = 1})
		CoreVFXraise:Play()
		CoreAppear:Play()
		StartupShockwave:Play()
		workspace.Core.StartupEmitter.StartParticles.Enabled = true
		workspace.Core.StartupEmitter.StartAura.Enabled = true
		workspace.Sounds.Shockwave:Play()
		wait(9)
		AnnouncerBeep:Play()
		wait(1)
		workspace.AnnouncerMessages.StartupMessages.Message6:Play()
		workspace.Core.StartupEmitter.StartAura.Enabled = false
		wait(8)
		AnnouncerBeep:Play()
		wait(1)
		workspace.AnnouncerMessages.StartupMessages.Message7:Play()
		wait(14)
		AnnouncerBeep:Play()
		wait(1)
		workspace.AnnouncerMessages.StartupMessages.Message8:Play()
		wait(4)
		workspace.Values.ReactorChamberLightsColor.Value = Color3.new(0,0,0)
		workspace.Sounds.LightsOff:Play()
		wait(1)
		workspace.Values.ReactorChamberLightsColor.Value = Color3.new(1,1,1)
		workspace.Values.FacilityLightsColor.Value = Color3.new(1,1,1)
		workspace.Sounds.LightsOn:Play()
		workspace.Values.LaserLightsControlValue.Value = Color3.new(0,1,0)
		wait(1)
		AnnouncerBeep:Play()
		wait(1)
		workspace.AnnouncerMessages.StartupMessages.Message9:Play()
		wait(5)
		workspace.Core.StartupEmitter.StartParticles.Enabled = false
		workspace.Values.ReactorCoreIsActive.Value = true
		workspace.Values.ShutdownCmdWorks.Value = true
	end
	
end

script.Parent.Buttons.Main_Power_Button.ClickDetector.MouseClick:Connect(onClicked)

Again, it will be tested using a part and the solution will be pasted into the script above (at the end of the startup failure)

you will probably notice there is 1,1 math.random chances, this is intended and it is that way to guarantee a startup failure so i can test it.

I’ve only glanced at this, but what I would do is use a :GetDescendants() loop when the game starts for the first time and clone everything, and place it in a new folder. Then, when you want to reset the game you can have a script destroy everything except for that folder with cloned items and then clone everything from the folder and place it in its corresponding spots.

Keep in mind that you’ll probably want to do all of the different things under game seperately since there are certain things you can’t clone, e.g. clone everything from workspace, then from lighting, etc. with each of those being in a different folder.

If you need additional assistance, I’d be happy to help.

1 Like

Did you try to close the game on the startup? You could clone the enitre game using game:Clone() so after that you could put in in a folder then get the assets 1 by 1 using :GetDescendants() then perhaps pasting it into workspace or everything needed

1 Like

i dont understand all of this, im a beginner, simplify?

i see, just dont know how to clone it with scripts, im a beginner

i assume you mean clone everything, move it in server storage or etc, and then when i need to reset the map, delete workspace and put that in?

sadly, that isnt possible.
image

Why should that not be possible?

Security reasons, i assume, but i am not sure

what i was saying is, i was assuming he meant to clone the workspace as soon as the server started up, then when i needed to reset the map clone all of the children into workspace after deleting everything in workspace

1 Like

Whole workspace or whole game? Like serverstorage lighting and more?

assuming i need to clone all the other stuff, whole game

i also need scripts reset to when the game first ran

Tmm wait


i have studio open rn, ill check what i need reset

i only need to clone the workspace

i also need scripts and all the children in the workspace cloned while the scripts preserved dont activate (some are connected to a clickdetector)

nah, theres only a day and night script that i dont need preserved, thats supposed to loop forever

i plan on cloning workspace into ServerStorage

only the workspace? why didnt you say so?
its really simple, before the startup, you can put everything thats in the workspace inside a table, and then after the explosion, you destroy everything from the workspace and replace it with the cloned ones.

-- create a folder before startup that stores everything from the workspace
local folder = {}

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

-- ...
-- after the explosion, you can destroy everything from the workspace (except for the players), and then you go through the folder table and parent everything to the workspace.
for i, v in ipairs(workspace:GetChildren()) do
	if v.Name == 'Terrain' or v.Name == 'Camera' or game.Players:GetPlayerFromCharacter(v) then continue end
	v:Destroy()
end

for i, v in ipairs(folder) do
	v.Parent = workspace
end

because i thought i needed to clone everything else at the time of making the post

1 Like

is this folder allowed to go into serverstorage? (so it doesnt overlap with the current map)