Leaderboard issue

So, in the script below, I want the Cash value and the Level value to be shown on the leaderboard but not the exp and kills value. Do I have to make a separate folder for values the exp and kills value or is there a way to disable them from being shown on the leaderboard?

local function loadData(player)
	local profile = Instance.new("Folder")
	profile.Name = "leaderstats"
	profile.Parent = player
	
	local cash = Instance.new("IntValue")
	cash.Name = "Cash"
	cash.Parent = profile
	
	local level = Instance.new("IntValue")
	level.Name = "Level"
	level.Parent = profile
	
	local exp = Instance.new("IntValue")
	exp.Name = "Exp"
	exp.Parent = profile
	
	local kills = Instance.new("IntValue")
	kills.Name = "Kills"
	kills.Parent = profile
end
1 Like

I think you will need to store them in a different folder then the leaderstats one.

You can create a new folder as the child to the player (like the leaderstats folder) and rename it to something other than “leaderstats.” You can then set exp and kills’ parents to the new folder. This will be hidden from the leaderstats.

local function loadData(player)
	local profile = Instance.new("Folder")
	profile.Name = "leaderstats"
	profile.Parent = player
	
	local cash = Instance.new("IntValue")
	cash.Name = "Cash"
	cash.Parent = profile
	
	local level = Instance.new("IntValue")
	level.Name = "Level"
	level.Parent = profile


    local Stats= Instance.new("Folder")
	Stats.Name = "Stats" -- Change "Stats" to what you want
	Stats.Parent = player
	
	local exp = Instance.new("IntValue")
	exp.Name = "Exp"
	exp.Parent = Stats
	
	local kills = Instance.new("IntValue")
	kills.Name = "Kills"
	kills.Parent = Stats
end
2 Likes

Most people store values that they don’t want to be seen within the player, or a folder within the player (other than leaderstats)

Make the parent to the Cash and level values “leaderstats”. Then make the exp and kill values parent “player”

Like this:


local function loadData(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	
	local cash = Instance.new("IntValue")
	cash.Name = "Cash"
	cash.Parent = leaderstats
	
	local level = Instance.new("IntValue")
	level.Name = "Level"
	level.Parent = leaderstats
	
	local exp = Instance.new("IntValue")
	exp.Name = "Exp"
	exp.Parent = player
	
	local kills = Instance.new("IntValue")
	kills.Name = "Kills"
	kills.Parent = player
end

local function loadData(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

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

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

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

	local kills = Instance.new("IntValue")
	kills.Name = "Kills"
	kills.Parent = player
end

The most common way to store stats (and exclude them from the leaderboard) is to parent them directly to the player instance itself, that way they can be fetched quicker (don’t need to reference the player then the folder when accessing the stats, you just need to reference the player for the stats).