(line 64) new.Image.Place.Text = number
What is Place? It shows an error that “Place is not a valid member of ImageLabel”.
I know this post is pretty old, but if somebody is still around please help.
(line 64) new.Image.Place.Text = number
What is Place? It shows an error that “Place is not a valid member of ImageLabel”.
I know this post is pretty old, but if somebody is still around please help.
Name your text label inside the ImageLabel Place
. The code simply needs to reference that text label.
For a working demo that you can copy / look at for reference see the OP.
How could I change this to fit a monthly basis?
How this can be accomplished was explained in the OP:
Will this automatically create a new key after a month? And will it keep going after the first month?
It should because os.date()
and os.time()
change automatically over time – since the key is referring to that variable, it’ll update as soon as the month changes.
The key will be as accurate as when it is generated. So if your server lasts multiple months, you’d likely want to update the key. Essentially instead of using a bunch of calls to remove data, you’re just using new keys instead.
To reset a player’s stats you would have to remove their value from the ordered datastore of set it to 0. Note that if you have a datastore which saves this value as well, you’d have to reset both.
Ordered datastores have the same set / remote methods as regular ones, the only difference is that ordered datastores can only store numerical values.
Using datastores in they way your describing is a little off-topic for this tutorial, so if you have further questions you might want to start a new thread.
local sf = sg:WaitForChild("ScrollingFrame")
Attempt to index nil with "WaitForChild"
I also followed your example but it gives me this error
This means that the Instance you’re calling :WaitForChild()
on does not exist (which would be the variable of “sg”).
Ensure that the Instance that is stored in the “sg” variable is not nil at the time of referencing it to prevent the script from erroring.
Example check:
if sg then
local sf = sg:WaitForChild("ScrollingFrame")
else
warn("No value stored for 'sg'/the Instance does not currently exist.")
end
As @StrongBigeMan9 explained, this is because you haven’t properly defined the sg (the SurfaceGui) variable.
See the original post for a working demo & tutorial on how to properly get started.
@ThatTimothy Do you have any idea on how I can achieve something similar to the circled part of this leaderboard?
It’s just different ui styling. If the position is equal to 1, then use a different sample frame. This can be customized however you want, with different layouts like the one above.
Since my leaderstat value is a decimal, how would I make it work with that? Will it work the same if I use :GetDataStore instead of :GetOrderedDataStore?
OrderedDataStores
only accept integers, which means that you would need to use math.floor
or math.ceil
(documentation for that can be found here) in order to convert the decimal into a whole number.
You wouldn’t be able to use :GetDataStore
for this kind of leaderboard because the values are not sorted in regular DataStores
.
I tried them both but the value on the leaderboard is still nil.
(Error)
Could you provide the code you’re using?
The OrderedDataStore can only store numerical integers, so you need to make sure you’re saving valid values.
Several solutions:
local someValue = 931.3819199293
--Just make it an integer
math.floor(someValue) --> 931
local someValue = 931.3819199293
--Store a certain number of decimal places:
local storedValue = math.floor( someValue * 1000 ) --> 931381
--And then convert is back when displaying:
storedValue / 1000 --> 931.381
Thanks very useful it helps a lot of new developers like me
How do I make it so that it shows people who are not in the server?