Weird Leaderstats Bug, Works For Everyone But Me?

Hello! My friend recently got into coding a made a simple leaderstats script as follows:

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAppearanceLoaded:Connect(function(character)

        local leaderstats = Instance.new("Folder", player)
        leaderstats.Name = "leaderstats"

        local gold = Instance.new("IntValue", leaderstats)
        gold.Name = "Gold"
        gold.Value = 10
    
    end)
end)

Whenever the game is run, a weird ‘‘Level’’ as shown here:

In the output we also get this error when running the code (from his baseplate):

But whenever I run it from mine, it works as it should. The ‘‘Gold’’ numbervalue is placed inside the leaderstats and I have no errors in output

Could this be an internal/roblox sided error, or are we missing a key feature here?

PS: We tried to follow older posts explaining that you need to have the game published and a description, didnt work. We also tried to enable API services (as shown in the output), didnt work.

7 Likes

It seems that it is actually making two leaderstats:

However, we never made the ‘‘level’’ leaderstasts

3 Likes

Is it ran from a local script, hence the error?

5 Likes

Nope, it is run from ServerScriptService in a Server Script

4 Likes

You don’t really need to wait for the character to load, for leaderstats.

Try this:

game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder", player)
    leaderstats.Name = "leaderstats"
    
    local coins = Instance.new("IntValue", leaderstats)
    coins.Name = "Coins"
    coins.Value = 0
end)
3 Likes

Yeah we tried to just run the PlayerAdded event, same result…

2 Likes

Can you try actually running my script and see if it works however?

2 Likes

Is there is any other scripts that also makes an another “leaderstats” folder with level value?

2 Likes

Yeah so the thing is when I run the script I only have the ‘‘Gold’’ numbervalue in my leaderstats, and it works just fine

But when my friend runs it, on a newly made baseplate with nothing inside, this is what he gets:

2 Likes

Try running my script and see if it works.

It creates a “Coins” value in the leaderstats only.

2 Likes

No scripts at all; we’ve tried to open up 3-4 empty baseplates by now, looked through everything and the only script that is in the game when running are the Default Roblox Studio scripts and our leaderstats script

2 Likes

It works for me, I tried making it before making this post aswell, we tried to run it on my friends baseplate; doesn’t work for him but it did infact work for me

2 Likes

That is actually impossible, there is should be another script which runs a different code and makes such different folder and value.

edit: I’ve already tried both script that you and @DiamondDrencher have provided and they working fine as they should.

2 Likes

Yeah, we are super confused aswell. There is nothing, we went through everything before running the game in studio, vs after. No extra scripts anywhere, no plugins that insert a script, just nothing - yet somehow it makes a ‘‘leaderstats’’ folder with a numbervalue and calls it ‘‘Level’’ - Should we contact Roblox staff / support ?

2 Likes

What we mean is your script must work, with what you given.

It must be something else.

2 Likes

I understand, but there is NOTHING else in the game, it’s a fresh baseplate with 1 single script inside, none of his plugins are allowed to inject scripts, so that can’t be the reason, and they are all fresh, just created baseplates…We could try doing it in team create to see if that might be helpful?

Contact a devforum staff to help you with this one, since it must be working.

3 Likes

It seems we have fixed the error by restarting his pc and his drivers, then reinstalling Roblox studio. I still don’t understand why this was happening, and how we should prevent it in the future when it might happen again. I hope Roblox Staff would look into this.

1 Like

What could’ve happened is this:

Every time you test your game on Roblox Studio, it does save assets for performance, some of which relating to scripts.

Maybe the leaderstats folder with the “Level” value was saved into Roblox, the reason being why you only get the Level value, and sometimes both.

Since no solution was provided to your issue, you can mark your own comment as one, since you resolved your own issue.

I’d contact Roblox to fix this issue though.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.