Would this cause stack overflow?

I’m trying to make a round system and every time the repeat loop ends the function would get called again.
But I was curious should it cause any issues like stack overflow.

(function()
	coroutine.wrap(function()
		if #Players:GetPlayers() >= 1 then
			local function Start()
				Counter.Value = 600
				repeat
					task.wait(1)
					Counter.Value -= 1
				until Counter.Value <= 0
				workspace:SetAttribute("GameENDED",true)
				-- ... other stuff
				Start()
			end
		end
	end)()
end)()

No, but it’s not particularly the cleanest or most readable way of making a round system.

What’s a better way to do it?
I’m trying to get a player with the highest amount.

local TemplateTable = {
	["Values"] = {
		["HighExecutes"] = 0,
		["HighKills"] = 0,
		["HighDeaths"] = 0
	},
	["CorrectNames"] = {
		"Kills",
		"Deaths",
		"Executes"
	},
	["Holders"] = {
		["Kills"] = {
			["Owner"] = "",
			["Amount"] = {},
			["HighestAmount"] = 0
		},
		["Executes"] = {
			["Owner"] = "",
			["Amount"] = {},
			["HighestAmount"] = 0
		},
		["Deaths"] =  {
			["Owner"] = "",
			["Amount"] = {},
			["HighestAmount"] = 0
		}
	}
}
for _,v in ServerStorage.Datas:GetDescendants() do
				if table.find(TemplateTable.CorrectNames, tostring(v)) then
					if TemplateTable.Holders[tostring(v)].HighestAmount >= v.Value then
						print("yeah")
						table.insert(TemplateTable.Holders[tostring(v)].Amount, v.Value)
						TemplateTable.Holders[tostring(v)].Owner = v.Parent.Parent.Name
					end
				end
			end

But It isn’t getting any

your code currently checks if the data’s highest amount is less than or equal to ( 0 / highest amount) which i believe isn’t what you were intending to do.

HighestAmount still remains the same and doesn’t check whats the highest value.
Nvm I managed to fix it. But to add the highest value I do this?

if v.Value > TemplateTable.Holders[tostring(v)].HighestAmount  then
	table.insert(TemplateTable.Holders[tostring(v)].Amount, v.Value)
	TemplateTable.Holders[tostring(v)].HighestAmount = v.Value
	TemplateTable.Holders[tostring(v)].Owner = v.Parent.Parent.Name
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.