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: How do I do this?

Previous Thread :: Next Thread 
ZeroHour66 is not online. ZeroHour66
Joined: 14 Sep 2013
Total Posts: 1511
24 Jun 2014 09:09 PM
Okay, so there's a script in a TextLabel, How do I make it so the text in the textlabel shows the amount of players in that server?
Report Abuse
secretidagent is not online. secretidagent
Joined: 07 Nov 2010
Total Posts: 1600
24 Jun 2014 09:11 PM
function Update()
script.Parent.Text = game.Players.NumPlayers
end
game.Players.PlayerAdded:connect(Update)
game.Players.PlayerRemoving:connect(Update)
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
24 Jun 2014 09:12 PM
c = game.Players:GetChildren()
num = nil

for i = 1,#c do
num = num + 1
end

TextLabel.Text = "Number of players in the server: "..num
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TextLabel.Text = "Number of players in the server: "..#game.Players:GetChildren()

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Both will work, one just looks cooler :3
Report Abuse
secretidagent is not online. secretidagent
Joined: 07 Nov 2010
Total Posts: 1600
24 Jun 2014 09:13 PM
@Goulstem
Yours would work fine, but I would do :GetPlayers()
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
24 Jun 2014 09:14 PM
game:GetService('RunService').RenderStepped:connect(function()
TextLable.text = "Number of players in the server : "..#game.Players:GetChildren()
end)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This will update aproximately every 1/60th of a second.
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
24 Jun 2014 09:15 PM
um
while wait(0) do
script.Parent.Text = "Players in server: "..game.Players.NumPlayers
end

--works just fine, doesn't lag, gives computer little time!
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