Leaderstats not showing the name in the topbar?

Hello all! This may be a simple thing but i couldk not find any information.
I have a leaderstats with a IntValue. The value are showing, but not the name of the stat.
My code is this (on a script):

local leaderstats = Instance.new("Folder", player)
	leaderstats.Name = "leaderstats"
	local Ld = Instance.new("IntValue", leaderstats)
	Ld.Name = "Gold"
	Ld.Value = 10

Captura

As you can see in the image, the value is shown but not the name “gold”. I’ve tried with a StringValue but no success. Im trying to make a leaderstats with a StringValue and a IntValue.

[EDIT: the code is working fine. Actually i’ve just discovered that this happens only when you’re the first on the server, or using Play on studio. When you collapse the leaderstats, it starts to show the name]

Thank you all!

2 Likes

Are you sure that’s in a server script?

Also unrelated but still related, you might want to take a look at this:

2 Likes

It’s a server script yes. Thank you for the link, i usually instance things and parent them later but for this scenario i’ve tried instancing inside the parent just in case that was causing the problem, but no luck

1 Like

Can you provide a .rbxl so that I can reproduce the issue? It seems like there might be another script interfering here, or you’re doing something wrong that I can’t tell from the code provided.

EDIT: Try making ‘leaderstats’ an IntValue, like so:

local leaderstats = Instance.new("IntValue")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player

local Ld = Instance.new("IntValue")
Ld.Name = "Gold"
Ld.Value = 10
Ld.Parent = leaderstats
1 Like

The issue is that the leaderboard is registering the value before the property is set. You should always make it a habit to set properties before parenting. Not only is it good for performance, but it avoids odd cases such as this.

That aside, it should show just “Value” if the name isn’t set. Values with the name of Value are probably ignored for display. I haven’t had a look at the CoreScripts in some time.

1 Like

This is not correct, I’ve just tested and you can name them ‘Value’ (or leave them unnamed).

image


Using the code provided in the OP, I was able to achieve the desired result. If you could provide a .rbxl to reproduce this @cKolmos that would be great.

image

1 Like

Actually i’ve just found something strange: when you are the first in the server, the names are not shown until you collapse the leaderstats list. Maybe a windows10 thing?

I mentioned this at first. The second was a statement of unease. What I said initially was still correct; properties should be set before the parent.

I think this is actually a bug, it has been happening to me too. You need to reopen the server list for the problem to be fixed.

3 Likes

I fixed it by doing what @LordHammy referenced in his post. By setting the parent after setting the other variables I got it to display normally. It may still be a bug though.

After testing it a few times, it doesn’t actually seem to have worked. It only works when you click on it to hide/show it. Although I only tested it in studio, not outside of it.

It happens to me all the time in Studio. I simply readjust the game window size and the titles reappear. I haven’t seen it happen in the actual game though, so assuming it’s just a Studio thing.

I have seen it in the Studio before too, but I have seen it in game also. It might not bug out as much in game.

I made a bug report:

2 Likes

Thank you!