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: Leaderboard Problem

Previous Thread :: Next Thread 
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
17 Jun 2014 01:28 PM
game.Players.ChildAdded:connect(function(child)
print(child.Name)
update()
end)

game.Players.ChildRemoved:connect(function(child)
print(child.Name)
update()
end)

function update()
local plrs = game.Players:GetPlayers()
for i = 1,#plrs do
for i,v in pairs(plrs[i]:WaitForChild('PlayerGui'):WaitForChild('ScreenGui'):GetChildren()) do
if v:IsA('TextLabel') then v:Destroy()
end
end
local plr_label = script:WaitForChild('TextLabel'):Clone()
plr_label.Parent = plrs[i]:WaitForChild('PlayerGui'):WaitForChild('ScreenGui')
plr_label.Position = UDim2.new(1,-205,0,15+(i*25)+5)
plr_label.Name = plrs[i].Name
plr_label.Text = plrs[i].Name
end
end

So it works, but it only shows the player's name, no one else's. I know the problem is because of the for loop/function, but I can't seem to fix it. I just can't think straight today.

Thanks!
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
17 Jun 2014 01:29 PM
I just glanced at it, but you might want to use ipairs() instead of pairs() in this case...

What's the error you're getting?

-The [Guy]
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
17 Jun 2014 01:32 PM
No error. It works, but it only shows my name, not anyone else's.

EX:

players:

Player1

Player2

Player1's PlayerGui:

Player1
--player2 should be here

Player2's PlayerGui:

--player1 should be here
Player2
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
17 Jun 2014 01:42 PM
1
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
17 Jun 2014 03:04 PM
2
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
17 Jun 2014 03:20 PM
3
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
17 Jun 2014 03:24 PM
4
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
17 Jun 2014 03:31 PM
5
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
17 Jun 2014 05:36 PM
6
Report Abuse
Stefan631 is not online. Stefan631
Joined: 23 Dec 2010
Total Posts: 1350
17 Jun 2014 05:39 PM
What's the difference between pairs and ipairs?

Can they be used interchangeably?
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
17 Jun 2014 05:46 PM
ipairs in order, treats as array
in pairs not in order
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
17 Jun 2014 07:08 PM
7
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
17 Jun 2014 10:47 PM
8
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