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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: NumPlayers?

Previous Thread :: Next Thread 
Dralian is not online. Dralian
Joined: 21 Mar 2013
Total Posts: 7624
05 Nov 2015 08:14 AM
if game.Players.NumPlayers <=1 then
for _,player in pairs(game.Players:GetPlayers()) do
if player then
player.Character:MoveTo(Vector3.new(math.huge))
end
end
end

That won't work. Not exactly sure why. I don't usually use NumPlayers so I am trying to learn more about it.

Thanks!
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
05 Nov 2015 08:16 AM
I think you meant to do game.Players.NumPlayers >= 1 (greater than or equal to) NOT <= (less than or equal to)
Report Abuse
Dralian is not online. Dralian
Joined: 21 Mar 2013
Total Posts: 7624
05 Nov 2015 08:17 AM
It's early, sorry, thanks.

Either way it wouldn't work.

I'm trying to create a 'Round' script per say. So once a certain number of players are in the game - stuff happens.
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
05 Nov 2015 08:18 AM
Should work based on the bits you provided, are you sure its not a problem elsewhere in your script? Also I recommend just adding a bunch of prints throughout the scripts and which ones print.
Report Abuse
Dralian is not online. Dralian
Joined: 21 Mar 2013
Total Posts: 7624
05 Nov 2015 08:19 AM
It's one script atm.

Should I just use RemoteEvents for this?

It's probably not necessary, but y'know.

Thanks for the advice though, I can give that a shot.
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
05 Nov 2015 08:22 AM
No, only use remote events/functions when you need to pass data between the client -> <-server.
Report Abuse
Dralian is not online. Dralian
Joined: 21 Mar 2013
Total Posts: 7624
05 Nov 2015 08:22 AM
I'll end up using GUI's locally though.
Report Abuse
Robertoman is not online. Robertoman
Joined: 10 May 2007
Total Posts: 6369
05 Nov 2015 08:46 AM
math.huge is not a vector value, you need to put a vector value inside of Vector3.new(num1,num2,num3)
Try Vector3.new(math.huge,math.huge,math.huge)
Report Abuse
Dralian is not online. Dralian
Joined: 21 Mar 2013
Total Posts: 7624
05 Nov 2015 11:13 AM
Okay, thanks.
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
05 Nov 2015 11:46 AM
I recommend not using NumPlayers, I would make sure there are 1 or more players with ACTIVE characters.

Also:

local Players = game:GetService("Players");
if Players.NumPlayers >= 1 then

local PlayersChildren = Players:GetPlayers();
for P = 1, #PlayersChildren do
PlayersChildren[P]:MoveTo(Vector3.new(math.huge, math.huge, math.huge));
end

end

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
Report Abuse
Robertoman is not online. Robertoman
Joined: 10 May 2007
Total Posts: 6369
05 Nov 2015 11:52 AM
You can't move a player object.
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
05 Nov 2015 11:54 AM
Oh man. :P I knew I was missing something, thanks for picking that up.

local Players = game:GetService("Players");

if Players.NumPlayers >= 1 then
local PlayersChildren = Players:GetPlayers();
for P = 1, #PlayersChildren do
local Character = PlayersChildren[P].Character;
if Character then
Character:MoveTo(Vector3.new(math.huge, math.huge, math.huge));
end
end
end

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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