of     1   

AdvancedDrone
#228336426Saturday, December 02, 2017 6:26 PM GMT

So I'm creating a game, and I've never used NumPlayers before and I'm having it so if theres two or more players it would do something, but if theres under two players then it wouldn't do anything until two players.. but it's not working But how would I make it so it repeats it so it doesn't only work once, because when I test it in studio and I add one player, it prints "not enough players" but when I add another player it doesn't print "starting game" if game.Players.NumPlayers == 2 then print('starting game') else print('not enough players') end
LuaCymru
#228336500Saturday, December 02, 2017 6:27 PM GMT

if #game.Players:GetChildren() >= 2 then print('starting game') else print('not enough players') end
LuaCymru
#228336587Saturday, December 02, 2017 6:28 PM GMT

To make it repeat, just enable and disable the script? depends on how the game works
Aliics
#228339491Saturday, December 02, 2017 7:10 PM GMT

game.Players.PlayerAdded:connect(function(player)) -- Check for if there enough players end) -- You might also want to check for the amount of players on PlayerRemoving / PlayerRemoved
LuaDeveloped
#228340268Saturday, December 02, 2017 7:23 PM GMT

Use the playeradded function and you also have a error use >=2 rather than ==, otherwise it will only run if there is 2 players no more or no less.
BloodDragonII
#228340328Saturday, December 02, 2017 7:24 PM GMT

number = 0 function count() for i,v in pairs(game.Players:GetPlayers()) do number = i print(number.. " Online") end if number >= 2 then print("There are enough players") elseif number < 2 then print("Not Enough Players!") end end game.Players.PlayerAdded:Connect(count) game.Players.PlayerRemoving:Connect(count) This script will count the number of players everytime someone joins or leaves and after it finishes counting if there are 2 or more players it will print that theres enough players if not it will say not enough players replace whats inide the if statements with what you want it to do
Savi_ooo
#228340449Saturday, December 02, 2017 7:26 PM GMT

local Players = game:GetService('Players') local function Check() if #Players:GetPlayers() >= 2 then return true end return false end while wait() do if Check() then print('Starting Game') else warn('Insufficient Players') end end ~ 𝓢𝖆𝖛𝖎
TNTeon
#228341266Saturday, December 02, 2017 7:42 PM GMT

can someone help me, I am getting this error that says ServerScriptService.MainScript:69: 'do' expected near '=' this is my code for i = 60,0,-1 and KingTouch = false do I know it has a problem with my = sign but i don't know why, please help me!
TNTeon
#228341433Saturday, December 02, 2017 7:46 PM GMT

by the way the answer to your problem is while game.Players.NumPlayers < 2 do print('There needs to be 4 or more players to begin') repeat wait(2) until game.Players.NumPlayers >= 2 end print('starting game')
TNTeon
#228341505Saturday, December 02, 2017 7:47 PM GMT

sorry it should be while game.Players.NumPlayers < 2 do print('There needs to be 2 or more players to begin') repeat wait(2) until game.Players.NumPlayers >= 2 end print('starting game')
imaski4
#228341543Saturday, December 02, 2017 7:48 PM GMT

TNTeon you have to use == false ok
TNTeon
#228341669Saturday, December 02, 2017 7:51 PM GMT

now it says ServerScriptService.MainScript:69: 'for' step must be a number
BloodDragonII
#228341751Saturday, December 02, 2017 7:52 PM GMT

TNTeon the KingTouch = false should be in an if statement and include the for statement in it
TNTeon
#228342062Saturday, December 02, 2017 7:58 PM GMT

I want it to stop changing i too and move on to the following script

    of     1