Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make DataStore not appear on leaderboard?

I've started to get to grips with DataStore but I don't want the values I have stored to appear on the leaderboard - I just want them to be stored so they can appear elsewhere (i.e, a GUI). How would I do this?

local DataStore = game:GetService("DataStoreService"):GetDataStore("Stats")

game.Players.PlayerAdded:connect(function(player)
	
	local stats = Instance.new("IntValue", player)
	stats.Name = "leaderstats" --Would I change this?
	
	local gold = Instance.new("IntValue", stats)
	gold.Name = "Gold"
	
	local key = "player-"..player.userId 
	
	local savedStats = DataStore:GetAsync(key)
	
	if savedStats then
		gold.Value = savedStats[1]
	else
		local newStats = {gold.Value}
		DataStore:SetAsync(key, newStats)
	end
	
end)


^Just testing it now which is why I only have one variable stored

1 answer

✓ Accepted answer

The ROBLOX leaderboard only appears if the values are placed into something named "leaderstats" - The easiest way around this therefore is, obviously, to rename the object you're placing all the values in (as you also pointed out in your script).

This discussion is preserved as it was. New answers, comments, and votes are closed.