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: Not enough player script?

Previous Thread :: Next Thread 
rubikscuberdude is not online. rubikscuberdude
Joined: 30 Mar 2010
Total Posts: 50
04 Sep 2012 11:35 AM
I was planing to make a game with a minimal of four players.

I saw some games with shouts if you're the only the only person "Not enough players!"

I wanted to know how to make a scipt it? Or do you know whats the name of it or is it avaleblie in free models?
Report Abuse
chickenman158 is not online. chickenman158
Joined: 18 Jan 2011
Total Posts: 915
04 Sep 2012 11:41 AM
Ok, this is how.

Game.Players:PlayerAdded:connect(function() {
players = Game.Players:GetChildren()
if(#players < 4) then
Instance.new("Message", Workspace).Text = "Not enough players"
else
Workspace.Message:Destroy()
end
}
Report Abuse
rubikscuberdude is not online. rubikscuberdude
Joined: 30 Mar 2010
Total Posts: 50
04 Sep 2012 02:46 PM
Thank you so much!
Report Abuse
Mathfreak231 is not online. Mathfreak231
Joined: 21 Jun 2010
Total Posts: 5311
04 Sep 2012 04:05 PM
or

repeat wait() until #game.Players:GetChildren() >= 4

FAIL COBRAS!
Report Abuse
galaxen is not online. galaxen
Joined: 27 Sep 2008
Total Posts: 1841
04 Sep 2012 04:24 PM
Use

game.Players.NumPlayers

or

game.Players:GetPlayers()

instead, a :GetChildren() can get unwanted results (rearly but still)
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
04 Sep 2012 06:36 PM
repeat wait(1) until Game.Players.NumPlayers >= 4
Report Abuse
rubikscuberdude is not online. rubikscuberdude
Joined: 30 Mar 2010
Total Posts: 50
06 Sep 2012 02:55 PM
So what would the script look like?
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
06 Sep 2012 03:48 PM
playersNeeded = 4
whenThereIsEnoughPlayers = function()
-- what happens when there is a substantial amount of players
end

repeat wait(1) until Game.Players.NumPlayers >= playersNeeded
whenThereIsEnoughPlayers()
Report Abuse
rubikscuberdude is not online. rubikscuberdude
Joined: 30 Mar 2010
Total Posts: 50
08 Sep 2012 06:21 PM
Thanks so much!
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