local S=script.Parent local z=nil local J=Region3.new(Vector3.new(S.Position.X-S.Size.X/2,S.Position.Y+S.Size.Y/2,S.Position.Z-S.Size.Z/2),Vector3.new(S.Position.X+S.Size.X/2,S.Position.Y+4,S.Position.Z+S.Size.Z/2))local U=game.Workspace:FindPartsInRegion3(J)for S,J in pairs(U)do if J and(J.Parent and J.Parent:IsA("\084\111\111\108"))then z=J.Parent break end end local K=S.Configurations local t={}local function v(S,z)if K:FindFirstChild(S)then t[S]=(K:FindFirstChild(S)).Value else t[S]=z end end v("\083\112\097\119\110\067\111\111\108\100\111\119\110",5)if z then z.Parent=game.ServerStorage while true do local S=z:Clone()local J=S:FindFirstChild("\072\097\110\100\108\101")S.Parent=game.Workspace local U=true local K K=S.AncestryChanged:connect(function()if J then J.Anchored=false end U=false K:disconnect()end)if J then print("\114\101\109\111\118\101\100 \115\112\105\110")J.Anchored=true end while U do if J then print("\114\101\109\111\118\101\100 \115\112\105\110\110\105\110\103")end wait()end wait(t.SpawnCooldown)end end
-- See if I have a tool
local spawner = script.Parent
local tool = nil
local region = Region3.new(
	Vector3.new(
		spawner.Position.X - spawner.Size.X / 2,
		spawner.Position.Y + spawner.Size.Y / 2,
		spawner.Position.Z - spawner.Size.Z / 2
	),
	Vector3.new(
		spawner.Position.X + spawner.Size.X / 2,
		spawner.Position.Y + 4,
		spawner.Position.Z + spawner.Size.Z / 2
	)
)
local parts = game.Workspace:FindPartsInRegion3(region)
for _, part in pairs(parts) do
	if part and part.Parent and part.Parent:IsA("Tool") then
		tool = part.Parent
		break
	end
end

local configTable = spawner.Configurations
local configs = {}
local function loadConfig(configName, defaultValue)
	if configTable:FindFirstChild(configName) then
		configs[configName] = configTable:FindFirstChild(configName).Value
	else
		configs[configName] = defaultValue
	end
end

loadConfig("SpawnCooldown", 5)

if tool then
	tool.Parent = game.ServerStorage

	while true do
		-- put tool on pad
		local toolCopy = tool:Clone()
		local handle = toolCopy:FindFirstChild("Handle")
		toolCopy.Parent = game.Workspace
		local toolOnPad = true
		local parentConnection
		parentConnection = toolCopy.AncestryChanged:connect(function()
			if handle then
				handle.Anchored = false
			end
			toolOnPad = false
			parentConnection:disconnect()
		end)
		if handle then
			print("removed spin")
			handle.Anchored = true
		end
		-- wait for tool to be removed
		while toolOnPad do
			if handle then
				print("removed spinning")
			end
			wait()
		end

		-- wait for cooldown
		wait(configs["SpawnCooldown"])
	end
end
