How to restart a script after players are teleported?

In my script, I’m trying to teleport a group of players when they touch a part and when a countdown ends. Once they are teleported, how would I restart the script so that the next player can be teleported and the GUI will reset when they touch the part? I tried putting a while loop in the script but that didn’t work, so I just called the function. Here is my code:

local players = game:GetService("Players")

local part = script.Parent

local touchedPlayers = {}

local debounce = false
local inGame = false
local gameInProcess = false

local function teleportPlayers()
	for i, v in pairs(touchedPlayers) do
		-- make copy of map from serverstorage and teleport players to the copy
		local Map1 = game.ServerStorage.Map1
		wait()
		local Map1Copy = Map1:Clone()

		Map1Copy.Parent = workspace
		wait()
		v.Character.HumanoidRootPart.Position = Vector3.new(334.75, 122.25, 1.25)
	end
end

local function gameCheck()
	if #touchedPlayers >= 1 and inGame == false then
		inGame = true
		game.ReplicatedStorage["TimerGUI"]:FireAllClients() -- plays GUI timer
		wait(7)
		teleportPlayers()
		print("start game")
	else
		print("not enough players")
	end
end

local function gettingPlayer()
	part.Touched:Connect(function(hit)
		local hitModel = hit:FindFirstAncestorOfClass("Model")
		local humanoid = hit.Parent:FindFirstChild("Humanoid")
		if hitModel then
			local hitPlayer = players:GetPlayerFromCharacter(hitModel)
			if hitPlayer and debounce == false then
				debounce = true

				if not table.find(touchedPlayers, hitPlayer) then
					table.insert(touchedPlayers, hitPlayer)
					gameCheck()
				end
			end
			inGame = true
			debounce = false
		end
	end)

	players.PlayerRemoving:Connect(function(player)
		local tablePlayer = table.find(touchedPlayers, player)
		if tablePlayer then
			table.remove(touchedPlayers, tablePlayer)
		end
	end)
end

gettingPlayer()

if use while true do not run,the reason is a split second to run script.

use while wait(1) do.