Anyone can help please? Im trying to do game.Players.NumPlayers > 2 do print("There are enough players") else print("Need more players")
pls help
Just created a table with game.Players:GetPlayers() then compared the value of #allPlrs with 2
local allPlrs = game.Players:GetPlayers() if #allPlrs > 2 then print("There are enough players") else print("Need more players") end
I'm not the best with explaining anything, but hope this helps you understand a bit.
NumPlayers is deprecated. Here's what you can do instead
local Players = game:GetService("Players") local PlayerCount = 0 Players.PlayerAdded:Connect(function() PlayerCount = PlayerCount + 1 end) Players.PlayerRemoving:Connect(function() PlayerCount =PlayerCount - 1 end) while PlayerCount < 1 do print("Not enough players.") repeat wait(1) until PlayerCount > 1 end print("Enough players.")
Closed as Non-Descriptive by User#24403, Gey4Jesus69, ee0w, DinozCreates, and yHasteeD
This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.
Why was this question closed?