I added something to my leaderstats, but it's not showing and no errors

Hi,

So I added carrot to my leaderstats, but it’s not showing.

local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("MyDataStore")

game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	coins = Instance.new("NumberValue")
	coins.Name = "Gold"
	coins.Parent = leaderstats
	if myDataStore:GetAsync(player.UserId..' - Gold') then
		coins.Value =  myDataStore:GetAsync(player.UserId..' - Gold')
	else
		coins.Value = 0
	end

	Eggs = Instance.new("NumberValue")
	Eggs.Name = "Eggs"
	Eggs.Parent = leaderstats    
	if myDataStore:GetAsync(player.UserId..' - Eggs') then
		Eggs.Value =  myDataStore:GetAsync(player.UserId..' - Eggs')
	else
		Eggs.Value = 0
	end

	Milks = Instance.new("NumberValue")
	Milks.Name = "Milk"
	Milks.Parent = leaderstats    
	if myDataStore:GetAsync(player.UserId..' - Milks') then
		Milks.Value =  myDataStore:GetAsync(player.UserId..' - Milks')
	else
		Milks.Value = 0
	end
	
	Wool = Instance.new("NumberValue")
	Wool.Name = "Wool"
	Wool.Parent = leaderstats    
	if myDataStore:GetAsync(player.UserId..' - Wool') then
		Wool.Value =  myDataStore:GetAsync(player.UserId..' - Wool')
	else
		Wool.Value = 0
	end
	
	carrot = Instance.new("NumberValue")
	carrot.Name = "carrot"
	carrot.Parent = leaderstats    
	if myDataStore:GetAsync(player.UserId..' - carrot') then
		carrot.Value =  myDataStore:GetAsync(player.UserId..' - carrot')
	else
		carrot.Value = 0
	end
end)

game.Players.PlayerRemoving:Connect(function(player)
	local s,e = pcall(function()
		myDataStore:SetAsync(player.UserId..' - Gold',coins.Value)
	end)
	if e then
		warn('Failed saving "Gold" for '..player.DisplayName)
	end

	local s,e = pcall(function()
		myDataStore:SetAsync(player.UserId..' - Eggs',Eggs.Value)
	end)
	if e then
		warn('Failed saving "Eggs" for '..player.DisplayName)
	end

	local s,e = pcall(function()
		myDataStore:SetAsync(player.UserId..' - Milks',Milks.Value)
	end)
	if e then
		warn('Failed saving "Milk" for '..player.DisplayName)
	end
	
	local s,e = pcall(function()
		myDataStore:SetAsync(player.UserId..' - Wool',Wool.Value)
	end)
	if e then
		warn('Failed saving "Wool" for '..player.DisplayName)
	end
	
	local s,e = pcall(function()
		myDataStore:SetAsync(player.UserId..' - carrot',carrot.Value)
	end)
	if e then
		warn('Failed saving "carrot" for '..player.DisplayName)
	end
end)

game:BindToClose(function()
	for i, player in pairs(game.Players:GetChildren()) do
		player:Kick("Server Closed")
	end

	wait(2)
end)
2 Likes

I guess there is a limit to number of things in leaderstats (not sure, maybe).