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: Display Number of Players

Previous Thread :: Next Thread 
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
01 Jan 2014 02:49 PM
hi c:

I have a problem with the following snippet of code:

function displayPlayers(string)
for _,v in pairs(game.Players:GetChildren()) do
if v then
v = v +1
game.StarterGui.ScreenGui._TITLE._TEXT.Text = v
if v == 0 then
game.StarterGui.ScreenGui._TITLE._TEXT.Text = "No players"
end
end
end
end


displayPlayers(game.Players.NumPlayers)


heres the error c:

12:47:32.653 - Players.Player1.PlayerGui.ScreenGui._TITLE._TEXT.Script:32: attempt to perform arithmetic on local 'v' (a userdata value)
12:47:32.655 - Script 'Players.Player1.PlayerGui.ScreenGui._TITLE._TEXT.Script', Line 32 - global displayPlayers
12:47:32.656 - Script 'Players.Player1.PlayerGui.ScreenGui._TITLE._TEXT.Script', Line 41

Medium Script0r
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
01 Jan 2014 02:52 PM
I don't see much of an error, The Arithmetic Value of v is the children of Players PLUS a player added

Medium Script0r
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
01 Jan 2014 02:52 PM
game.StarterGui.ScreenGui._TITLE._TEXT.Text = game.Players.NumPlayers

Problem solved.
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
01 Jan 2014 02:54 PM
...

Medium Script0r
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
01 Jan 2014 04:19 PM
http://wiki.roblox.com/index.php/NumPlayers_(Property)

I'm not trolling...
Report Abuse
Azureous is not online. Azureous
Joined: 29 Jan 2012
Total Posts: 25287
01 Jan 2014 04:20 PM
Wazap is correct.

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