repeat wait()until script.Parent~=nil local g=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local w=g:WaitForChild("\077\111\100\117\108\101\115")local v=require(w.src.utils.Logger)local A=require(g.HotReloadServer)local C=A.getSavedState()local Q={}if C~=nil then Q=C.savedActions end local t={running=true;destructors={};savedActions={},wasReloaded=C~=nil}A.start({watch={(game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")).Modules;(game:GetService("\083\116\097\114\116\101\114\080\108\097\121\101\114")).StarterPlayerScripts.clientSrc;(game:GetService("\083\101\114\118\101\114\083\099\114\105\112\116\083\101\114\118\105\099\101")).serverSrc};beforeUnload=function()t.running=false for g,w in ipairs(t.destructors)do local v,A=pcall(w)if not v then warn("\070\097\105\108\117\114\101 \100\117\114\105\110\103 \100\101\115\116\114\117\099\116\105\111\110\058 "..A)end end return{savedActions=t.savedActions}end,afterReload=function() end})local c=require(script.main)c(t)
--[[
	Serves as the entry-point to the server code.

	This file contains a bit of ceremony to set up hot-reloading, which is only
	used during development.
]]

repeat
	wait()
until script.Parent ~= nil

local ReplicatedStorage = game:GetService('ReplicatedStorage')
local Modules = ReplicatedStorage:WaitForChild('Modules')

local logger = require(Modules.src.utils.Logger)

local HotReloadServer = require(ReplicatedStorage.HotReloadServer)

local savedState = HotReloadServer.getSavedState()
local savedActions = {}

if savedState ~= nil then
	savedActions = savedState.savedActions
end

local context = {
	running = true,
	destructors = {},
	savedActions = {},
	-- savedActions for hot reload
	wasReloaded = savedState ~= nil,
}

HotReloadServer.start({
-- The order of objects to watch is important, otherwise a hot-reloaded
-- server might start running before the modules it depends on are reloaded.
-- This function is sort of vestigial now.
-- It's used to run code after the new server function has started
-- running, and was previously used to respawn all players.
-- Now that the client code is hot-reloaded without respawning, there's
-- no need for this!
	watch = {
		game:GetService('ReplicatedStorage').Modules,
		game:GetService('StarterPlayer').StarterPlayerScripts.clientSrc,
		game:GetService('ServerScriptService').serverSrc,
	},
	beforeUnload = function()
		context.running = false

		for _, destructor in ipairs(context.destructors) do
			local ok, result = pcall(destructor)

			if not ok then
				warn('Failure during destruction: ' .. result)
			end
		end

		return { savedActions = context.savedActions }
	end,
	afterReload = function() end,
})

local main = require(script.main)
main(context)