Map system countdown is buggy

Hi! I’m here because of a map system countdown. I used a tutorial for the map system cuz small brain. Anyways, I encountered a bug with the countdown. If there are multiple players then the countdown keeps changing to random numbers. It’s because the function runs as soon as a player joins. I’ve tried running the function just once but it only appeared on one player’s screen and not the others. Any advice?

MapFunction:

``
function round.ToggleVoting()

local maps = ServerStorage.Maps:GetChildren()
votes = {}

for i,map in ipairs(maps) do
	votes[map.Name] = {}
end

info.Voting.Value = true




	for _,v in pairs(game.Players:GetPlayers()) do 
		for i = 13 , 1, -1 do
			info.Message.Value = "Map Voting (".. i ..")" 
			task.wait(1)
		end
		end
	




local winVote = "Grassland"
local winScore = 0
for name, map in pairs(votes) do
	if #map > winScore then
		winScore = #map
		winVote = name
	end
end


info.Voting.Value = false

		return winVote

end

Script that starts the game:

local Players = game:GetService(“Players”)

local mob = require(script.Mob)
local tower = require(script.Tower)
local round = require(script.Round)

local ServerStorage = game:GetService(“ServerStorage”)
local info =workspace.Info

local minPlayers = 1

Players.PlayerAdded:Connect(function()
local currentPlayers =#Players:GetPlayers()

if currentPlayers >= minPlayers then
	round.StartGame()
else
	workspace.Info.Message.Value = "Waiting for " .. (minPlayers - currentPlayers) .. " more player(s)... hopefully"
	wait(10)
	round.StartGame()
end

end)

You should not be running the code every time a player joins, The for loop is not even needed since it is not used. I’d advise you get rid of the for loop.

the for loop is used. Its used in another function, and that function is used in the round.StartGame function.

also, when should I use it then? I’ve tried only running it once.