Help with Winners and Round

Hello! Sorry for a lot of posts.

I am currently working on a new project, it’s an obby race type game(?). Everything is working great and no problems but I need to finish the Ending part in maps and if there are no players the round automatically ends and says all winners that touched the end part.

Here is the script:

-- Variables

local Status = game:GetService("ReplicatedStorage").RoundFolder.Status

local CurrentMap = game.Workspace.CurrentMap
local MusicFolder = game.Workspace.Music

local IntermissionMusic = MusicFolder.Intermission:GetChildren()
local ChoosingMusic = MusicFolder.Choosing

local IntermissionSound = IntermissionMusic[math.random(1, #IntermissionMusic)]

-- Round Settings

local MinPlayer = 2
local IntermissionTime = 15
local RoundTime = 60
	
	-- Intermission
	
while wait() do
	
	print("Intermission Started!")
	IntermissionSound:Play()
	
		for i = IntermissionTime, 1, -1 do
		Status.Value = "Intermission (" .. i .. ")"
		task.wait(1)
	end
	print("Intermission Ended!")
	IntermissionSound:Stop()
	
	ChoosingMusic:Play()

	Status.Value = "Choosing Map..."
	task.wait(2)
		
	-- Map Selector
		
	local Maps = game:GetService("ServerStorage").Maps:GetChildren()
	local ChosenMap = Maps[math.random(1, #Maps)]:Clone()
		
	ChosenMap.Parent = CurrentMap
	local MapMusic = ChosenMap.MapInfo:FindFirstChild("Sound")
	local MapDifficulty = ChosenMap.MapInfo:FindFirstChild("Difficulty")
	print(ChosenMap.Name .. " (" .. MapDifficulty.Value .. ")")
		
	Status.Value = ChosenMap.Name .. " (" .. MapDifficulty.Value .. ")"
	task.wait(2)
	
	for i = 10, 1, -1 do
		Status.Value = "Teleporting Players in " .. i
		wait(1)
	end
	
	-- Teleporting
	
	local MapTeleports = ChosenMap:FindFirstChild("Teleports")
	
	local Players = game.Players:GetChildren()
	for i = 1, #Players do
		if Players[i].Character ~= nil then
			local Teleport = math.random(1, #MapTeleports:GetChildren())
			Players[i].Character:MoveTo(ChosenMap.Teleports:GetChildren()[Teleport].Position)
			Players[i].Character.Humanoid.WalkSpeed = 0
			
			-- Starting Round
			
			for i = 3, 1, -1 do
				Status.Value = i
				wait(1)
			end
			Status.Value = "GO!"
			ChoosingMusic:Stop()
			Players[i].Character.Humanoid.WalkSpeed = 24
			MapMusic:Play()
			
			-- Round
			
			for i = RoundTime, 1, -1 do
				Status.Value = "Reach the Finish in " .. i
				wait(1)
			end
			
			-- Cleanup
			print("Cleaning Up...")
			
			Players[i]:LoadCharacter()
			print("Round Ended!")
			workspace.CurrentMap:ClearAllChildren()
			MapMusic:Stop()
			
			print("Restarting!")
		end
	end
end

I don’t know how I could do this, this is what most games with rounds have, like speed race. I want to know how I could add an end part, when the player touches it, it reloads their character and they get a win (in the leaderstats) and after the round ends, it will show the winners.

If the Players die while the round is still running, or if all players made it, the round ends and then goes back to intermission.

Again, I don’t know how to do this, but I mostly did everything but that. How can I do this?