|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 24 Jun 2014 09:13 PM |
@Goulstem Yours would work fine, but I would do :GetPlayers() |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|