Round gets played at the same time bu the amount of players in the game

so i was using the wait part of the script from yours but you have it as if there is not a players then the entre function returns and my brain doesn’t want to help me figure out what is to stop that so is there a way on the top your head that you can think of

Code Example

function Shared.Wait()
	task.wait(2)
	while task.wait(1) do
		print("If Not Enough Players Was Just Said There Is N Bug Here") -- prints at the start
		if CountPlayers() >= MIN_PLAYERS and not RoundOn then
			print("Max Players")
			task.wait(1)
			FailedRemote:FireAllClients(75)
			print("Fired Event")
		elseif not RoundOn then
			print("Not Enough Players") -- prints once then the first print doesn't print anymore
			FailedRemote:FireAllClients(2063)

			return
		end
		Round()
		RoundOn = true
		wait(5)
	end
end

change the min player to the amount of players you want

local MinPlayers = 0 --- change

its actualy max players but i got lazy

ive got it set to 2

im going on to roblox using a lt and my main to test so it doesn’t break the leaderboards llike it did twice
Showtoplayersinlobby

set the min player to the amount, if you were to set it to two, you would need 3 players as the amount of player neeeds to be greater then 2

for example

if you were to set the min player to 1 then 2 players need to join or else it will think that it doesnt work

heres the solution

if #players >= MinPlayers and not roundOn then
		print("Max Players")
		task.wait(1)
		SetUpRound:FireAllClients()
		print("Fired Event")
	elseif not roundOn then
		print("Not Enough Players")
		return
	end

wait im kinda confused on what your trying to achieve?

the problem is in this bitelseif not roundOn then print("Not Enough Players") return end the return it jus stops the whole function so even if another player joins it doesn’t play (its in a module)

its a serverscript :confused: not a module if you want a module then get rid of return

1 Like

yeah im pretty stupid :upside_down_face: ived just made the round the function in the module and made the wait part in a severscript

its alright, everyone makes mistakes along the way

1 Like

tell me if it works, if it isnt working then tell me

1 Like

nope i think return does the same thing as break in loops

this ended up working

while task.wait(1) do
	print("If Not Enough Players Was Just Said There Is N Bug Here") -- prints at the start
	if CountPlayers() >= MIN_PLAYERS and not RoundOn then
		print("Max Players")
		FailedRemote:FireAllClients(75,TIME_WAITIING)
		task.wait((TIME_WAITIING-3))
		StartSoundSFX:Play()
		task.wait(3)
		R.Round()
		RoundOn = true
		print("Fired Event")
	elseif not RoundOn then
		print("Not Enough Players") -- prints once then the first print doesn't print anymore
		FailedRemote:FireAllClients(2063)
	end
end
``` anyway thank you for the help!
1 Like

nvm fixxed it by adding a debounce

1 Like

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