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
 

Is it possible to change max players to 4?

Previous Thread :: Next Thread 
TheKJWINNERS is not online. TheKJWINNERS
Joined: 10 Feb 2011
Total Posts: 1337
04 Aug 2013 12:25 AM
My tycoon game is a bit laggy and I want to remove 2 of 6 tycoons to make it less laggy, by changing the max players to 4. Is it possible?
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
04 Aug 2013 12:28 AM
MaxPlayers = 4
game.Players.PlayerAdded:connect(function(Player)
if game.Players.NumPlayer <= 4 then
Player:Destroy()
end
end)
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
04 Aug 2013 12:29 AM
It's not possible to set the MaxPlayers to 4, but you can kick anyone who joins when there is more than 4 people (There is no point to doing that, though)
Report Abuse
TheKJWINNERS is not online. TheKJWINNERS
Joined: 10 Feb 2011
Total Posts: 1337
04 Aug 2013 12:29 AM
what does the destroy function do for a player? For parts, it removes.
Also, will after 4 players, then the 5th player will be in the new server?
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
04 Aug 2013 12:30 AM
:Destroy on a player essentially it kicks them.

No.
Report Abuse
Explodey is not online. Explodey
Joined: 19 Jun 2013
Total Posts: 1454
04 Aug 2013 12:30 AM
Nope. People will be raging and fighting over open servers.
Report Abuse
TheKJWINNERS is not online. TheKJWINNERS
Joined: 10 Feb 2011
Total Posts: 1337
04 Aug 2013 12:31 AM
Never mind then. Thanks for your help.
Report Abuse
Vector2D is not online. Vector2D
Joined: 11 May 2013
Total Posts: 195
04 Aug 2013 12:32 AM
The minimum you can have is four. However, you could use a script like the one below to keep more players from joining, though they can't make a new server.


game:GetService('Players')['PlayerAdded']:connect(function(player)
player:WaitForDataReady();

if (game:GetService('Players')['NumPlayers'] > 4) then
player:Destroy();
end;
end);
Report Abuse
Vector2D is not online. Vector2D
Joined: 11 May 2013
Total Posts: 195
04 Aug 2013 12:34 AM
Apologies, minimum is six; I wasn't really paying attention.
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
04 Aug 2013 12:54 AM
game.Players.PlayerAdded:connect(function(player)
if game.Players.NumPlayers > 4 then
player:Destroy()
end
end)
Report Abuse
Vector2D is not online. Vector2D
Joined: 11 May 2013
Total Posts: 195
04 Aug 2013 12:58 AM
@Useing
That won't always work.
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
04 Aug 2013 01:07 AM
My name isn't Useing so you're not talking to anyone

lol

besides that, how so? I works for me everytime I tried, I changed it to 0 and it worked over and over...
Report Abuse
Vector2D is not online. Vector2D
Joined: 11 May 2013
Total Posts: 195
04 Aug 2013 01:31 AM
@Useing
Your name, to me, is now an incorrect spelling of 'Using'.
Anyways; every time I've tried it (do note, I haven't touched Studio in a couple months), it'd work once, or twice, and immediately stop, whilst t'd continuously work after their data has been prepped for loading.
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
04 Aug 2013 02:36 AM
Ok then I just won't respond and think you're talking to someone else if you call me "Useing," I'll just think you're talking to someone else.
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
04 Aug 2013 02:37 AM
@Vector,
http://www.roblox.com/User.aspx?ID=28604773
Report Abuse
Vector2D is not online. Vector2D
Joined: 11 May 2013
Total Posts: 195
04 Aug 2013 01:07 PM
@Useing
You've already acknowledged that I am going to call you Useing.
Your character looks cool.
And, great, one less moron I have to deal with.
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