How to add a stringValue to leaderboard

So i have been trying to add a stringvalue so you get a rank the more money you have in-game
But it doesnt work. All off the IntValues Will show but not the StringValue is there any way to fix this?

game.Players.PlayerAdded:Connect(function(p)
local stats = Instance.new(“IntValue”, p)
stats.Name = “leaderstats”

local money = Instance.new("IntValue", stats)
money.Name = "Money"
money.Value = 50


local Resources = Instance.new("IntValue", stats)
Resources.Name = "Wheat"
Resources.Value = 0

local Research = Instance.new("IntValue", stats)
Research.Name = "Carrot"
Research.Value = 0

local Research = Instance.new("IntValue", stats)
Research.Name = "CC"
Research.Value = 0

local rank = Instance.new('StringValue', stats)
rank.Name = 'Rank'
rank.Value = 'Guest'

end)

is there any way to fix this?

I’m guessing that there are probably too many stats on the leaderboard at this point and the one with the stringvalue just happens to not render because of this.

1 Like

I see that the parent of the StringValue is not yet been set. You need to make a folder in the player called ‘leaderstats’ you then need to parent all things you want on the leaderboard to that folder.

Thanks it worked :smiley: This was really helpful you saved my entire day :smiley:

He was using the second parameter of Instance.new to set the parent, which I suppose does the same job but @Frepzter might want to consider setting the parent after all of the properties have been set. See this article.

Sorry I didn’t see the top of the code cause it wasn’t in the code block, and I didn’t realise there was more at the side lmao.