This script teleports everyone in the server to a certain spot no matter where they are. how would i change it so that it only teleports people from a certain area?

local status = game.ReplicatedStorage.status
local maps = game.ReplicatedStorage.maps:GetChildren()
while true do
	for i = 1,59 do
		status.Value = "Intermisson:"..59-i
		wait(1)
	end
	
	local rand = math.random(1, #maps)
	
	local map = maps [rand]:Clone()
	map.Parent = workspace
	
	status.Value = "we'll be playing "..map.Name
	wait(4)
	
	local players = game.Players:GetChildren()
	for i = 1,#players do
		if players[i].Character ~= nil then
			local spawnLocation = math.random(1,#workspace.Teleports:GetChildren())
			players.[i].Character:MoveTo(workspace.Teleports:GetChildren()[spawnLocation].Position)
			players.[i].Character.Parent = workspace.ingame
		end
	end
	
	local roundlength = 50
	local canwin = true
	
	if map:FindFirstChild("obby") then
		map.endpart.Touched:Connect(function(hit)
			if hit.Parent:FindFirstChild("Humanoid")then
				canwin = false
				status.value = hit.Parent.name.."he's won"
			end
		end)
	end
	
	repeat
		roundlength = roundlength -1
		status.Value =  "time left:"..roundlength
		wait(1)
	until roundlength == 0 or canwin == false or #workspace.ingame:GetChildren()==0
	
	wait(3)
	map: destroy()
	
	local players = game.Players:GetChildren()
	for i = 1, #players do
		if players[i].Character ~= nil then
			players[i]:LoadCharacter()
		end
		end
	end

1 comment