generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: If there is not 2 players; game will not start -HELP

Previous Thread :: Next Thread 
ninja5566 is not online. ninja5566
Joined: 14 Jan 2009
Total Posts: 5233
24 Dec 2012 03:38 PM
a=Instance.new("Message")
a.Parent = game.Workspace
c = game.Players:GetChildren()
for i=1,#c do
if c[i][2] == nil then
repeat
wait(1)
a.Text = "Need 2 players to start!"
until c[i][2] ~= nil
end
end
------------------------------------------
I don't know how to check for 2 people, I just don't know..

c[i][2] doesn't work..

Any help?
Report Abuse
Strieken is not online. Strieken
Joined: 17 Jun 2011
Total Posts: 3058
24 Dec 2012 03:46 PM
while true do
wait(1)
if game.Players.NumPlayers ~= 2 then
Instance.new("Message",Workspace).Text = "Need 2 players to start!"
elseif game.Players.NumPlayers >= 2 then
Workspace.Message:Destroy()
end
end


:[Contact me if you'd like to schedule production of a model/script through Valhalla Tech. More info within my profile.]:
Report Abuse
Protecter17 is not online. Protecter17
Joined: 18 Sep 2010
Total Posts: 2130
24 Dec 2012 03:47 PM
a=Instance.new("Message")
a.Parent = game.Workspace
c = game.Players:GetChildren()
for i=1,#c do
if c[i][2] == nil then
repeat
wait(1)
else --Maybe this would work. I'm just a noob at scripting, so I might not do well.
a.Text = "Need 2 players to start!"
until c[i][2] ~= nil
end
end
Report Abuse
1pie23 is not online. 1pie23
Joined: 11 Jul 2010
Total Posts: 1865
24 Dec 2012 03:49 PM
repeat wait() until #game.Players:GetPlayers() > 1
Report Abuse
FlamedSkull is not online. FlamedSkull
Joined: 23 May 2009
Total Posts: 1379
24 Dec 2012 03:53 PM
local LivePlayers = game.Players.NumPlayers
local GameRunning = false

game.Players.PlayerAdded:connect(function(player)
LivePlayers = LivePlayers + 1
if GameRunning == false then
checkPlayers()
end
end)

game.Players.PlayerRemoving:connect(function(player)
LivePlayers = LivePlayers - 1
if GameRunning == false then
checkPlayers()
end
end)

function checkPlayers()
if game.Players.NumPlayers >= 2 then
GameRunning = true
--stuff
end
end
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
24 Dec 2012 04:02 PM
Here's a good one:


stop = Instance.new("Hint",workspace)
stop.Text = "2 Players needed!"
repeat wait(1) until game.Players.NumPlayers > 1
stop:Destroy()
--Add stuff Here to do when There's 2+ Peoplez
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image