Leaderstats not working

I am trying to make a leader board that shows cash but it won’t work. There are no errors with the script or warnings. Here is the script:

game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	
	local cash = Instance.new("NumberValue")
	cash.Name = "SoopCoins"
	cash.Value = 10
	cash.Parent = leaderstats
end)

script goes inside ServerScriptService.

1 Like

I think the correct way is to use a Model and not a Folder if I reckon that correctly?

No. its not because i need it to show a leaderboard not a model

Never mind, turns out a folder is valid. I was looking at an old method then.

I think your issue is that the script won’t even run. Maybe there’s a draft list? Script disabled?

nope its enabled in serverscriptservice

try print statement inside this script
also check whether the script is in server script service or server storage

Is this a local script or a server script?

Its a server scripts in server script service

It prints all the conditions but still no leaderboard

can you show the hierarchy with the script selected and property window

It does work for me when I copy paste your code…

image

What. It doesnt work for me tho it wont even show. Any Settings or anything?

archivable enabled but disabled is false

Alright, can you send a screenshot of the location of your script. And also the properties tab of your script.

Some times when testing in studio, if your the first player that joins when the server just got created(in test mode) the player added event doesn’t fire.

1 Like

@it worked for me as well that’s why it would e helpful with screen shot

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true) might help as the initial line or you haven’t committed the script. Some users have drafts enabled and you need to open the draft window sometimes.

Make sure that you don’t have multiple folders with the name “leadaerstats”

I have a way(kinda hacky)

Try this script in:

for _,player in pairs(game.Players:GetPlayers()) do
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local cash = Instance.new("NumberValue")
	cash.Name = "SoopCoins"
	cash.Value = 10
	cash.Parent = leaderstats
end
game.Players.PlayerAdded:Connect(function(player)
	if not player:FindFirstChild("leaderstats") then
		local leaderstats = Instance.new("Folder")
		leaderstats.Name = "leaderstats"
		leaderstats.Parent = player

		local cash = Instance.new("NumberValue")
		cash.Name = "SoopCoins"
		cash.Value = 10
		cash.Parent = leaderstats
	end
end)