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

Previous Thread :: Next Thread 
SladeMaann is not online. SladeMaann
Joined: 16 Nov 2013
Total Posts: 61
02 Jan 2014 08:36 PM
Ok, so I am making my own leaderboard (for 1-10 players. :))

Script:

local players = game.Players:GetChildren()
local p1 = script.Parent.Player1
local p2 = script.Parent.Player2
local p3 = script.Parent.Player3
local p4 = script.Parent.Player4
local p5 = script.Parent.Player5
local p6 = script.Parent.Player6
local p7 = script.Parent.Player7
local p8 = script.Parent.Player8
local p9 = script.Parent.Player9
local p10 = script.Parent.Player10
local h = Instance.new("Hint")
h.Parent = game.Workspace

while true do
h.Text = "Updating Player's List"
for i = 1, #players do
p[i].Text = players[i].Name

if p[i].Text == "" then
p[i].Text = "Empty"
end
end
wait(1)
h:remove()
wait(5)
end


I get the error:

20:35:49.367 - Players.Player1.PlayerGui.PlayerList.List.Script:18: attempt to index global 'p' (a nil value)
Report Abuse
iWasted1000Robux is not online. iWasted1000Robux
Joined: 26 Oct 2013
Total Posts: 813
02 Jan 2014 08:37 PM
you havent set a value for "p"

#nerdsunited
Report Abuse
SladeMaann is not online. SladeMaann
Joined: 16 Nov 2013
Total Posts: 61
02 Jan 2014 08:39 PM
it's erroring at:

p[i]

in the for loop.
Report Abuse
i0x3x is not online. i0x3x
Joined: 27 Jan 2013
Total Posts: 1308
02 Jan 2014 08:44 PM
because p is nil

You set the variable to players, not me.
Report Abuse
SladeMaann is not online. SladeMaann
Joined: 16 Nov 2013
Total Posts: 61
02 Jan 2014 08:45 PM
>.>

No. I set p(1-10) to a TextLabel in a gui...

I'm attempting to call to that in a for loop placing a player at a certain spot using

p[i]

.....


Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
02 Jan 2014 09:34 PM
I don't think that's how you call elements in a table.
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
02 Jan 2014 09:58 PM
In one of my custom leaderboards, it is hidden except for when you are holding a hotkey. I used a simple for loop to build a gui for each player name. n the hotkey's release, the gui is removed completely.

~DiamondBladee~
Report Abuse
SladeMaann is not online. SladeMaann
Joined: 16 Nov 2013
Total Posts: 61
02 Jan 2014 11:59 PM
@Diamond:

Will try that. You're basically say that everytime a player joins, a new gui is created?
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
03 Jan 2014 12:02 AM
Sort of, not really. In the leaderboard I'm talking about, it is hidden by default. Whenever a player does something to make it appear on-screen, it makes a gui for each player after using game.Players:GetChildren()

~DiamondBladee~
Report Abuse
SladeMaann is not online. SladeMaann
Joined: 16 Nov 2013
Total Posts: 61
03 Jan 2014 12:03 AM
So, you're creating the gui everytime the button is pressed? But storing it somewhere within the game?
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
03 Jan 2014 12:13 AM
Nope, Im instancing an new one each time. I use :destroy() instead of visible = false.

~DiamondBladee~
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