Script running when 2 players join (out of 5)

Hello! I am creating a game where people need to join via a ProximityPrompt. 5 people can join the fight through it, but whenever 2 people join the script runs past the timer stage. I don’t know why this is. Any help been stuck for hours.

	local inFight = pFolder:GetChildren()
	gui.Frame.PlayerCount.Text = #inFight.."/5"
	
	if #inFight == 5 or timer.Text == 0 then
		prompt.Enabled = false
	end
	
	if #inFight == 1 then
		for i = 1,30 do
			timer.Text = 30-i
			wait(1)
		end
	end
	
	local tagged = script.Parent.Parent.Tagged

		--tags
		local selected = math.random(1, #inFight)
	inFight[selected].Parent = tagged.p1
		--
		local selected2 = math.random(1, #inFight)
	inFight[selected2].Parent = tagged.p2
		--
		local selected3 = math.random(1, #inFight)
	inFight[selected3].Parent = tagged.p3
		--
		local selected4 = math.random(1, #inFight)
	inFight[selected4].Parent = tagged.p4
		--
		local selected5 = math.random(1, #inFight)
	inFight[selected5].Parent = tagged.p5
end)
1 Like

You are comparing a string with a number, this will always be false.