Why does it have a error

Can you send the “ServerScriptService.PlayerData.Template” script?

Also for the leaderstats.Name, you misspelled it

Where did i misspell leaderstats.name

On this line: local function CreateLeaderStats(player: Players) (line 12), switch the “Players” after "player: " to “Player”.

The reason why this it showed red is because it only accepts the Player service as @PaleNoobs said.

It still doesn’t say nothing

Fixed that still doesn’t say anything

What do you mean by “it doesnt say anything”? Is it not showing the leaderstats?

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

Change this line so it parents the folder to the player itself and not the Players service

1 Like

The leaderboard doesn’t say anything

Show us the whole code so we can fix it.

Could you give me a example???

Because the leaderboard is not properly being parented to the player, as @Rekurii stated.

1 Like

I did already a cupel posts up

Could you give me the code for that and where to put it

@Rekurii wants you to change this to:

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

Cause you’re parenting the leaderstats to the Players service.

1 Like

Still nothing showing on the leaderboard

Show your updated code

local function CreateLeaderstats(player: Player)
	local leaderstats = Instance.new("Folder", player)
	leaderstats.Name = "leaderstats"

	local clicks = Instance.new("NumberValue", leaderstats)
	clicks.Name = "Clicks"
	clicks.Value = profile.Data.Clicks

	local gems = Instance.new("NumberValue", leaderstats)
	gems.Name = "Gems"
	gems.Value = profile.Data.Gems
end

The function should look like this

local Players = game:GetService(“Players”)
local ServerScriptService = game:GetService(“ServerScriptService”)

local Template = require(ServerScriptService.PlayerData.Template)
local Manager = require(ServerScriptService.PlayerData.Manager)
local ProfileService = require(ServerScriptService.Libs.ProfileService)

local ProfileStore = ProfileService.GetProfileStore(“2”, Template) – (1 = Test) (2 = Production)

local KICK_MESSAGE = “Could not find data Please rejoin If issue persists, contact us via group wall”

local function CreateLeaderStats(player: Player)
local profile = Manager.Profiles[player]
if not profile then return end

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

local coins = Instance.new("NumberValue", leaderstats)
coins.Name = "Clicks"
coins.Value = profile.Data.Clicks

local Gems = Instance.new("NumberValue", leaderstats)
Gems.Name = "Gems"
Gems.Value = profile.Data.Gems

end

local function LoadProfile(player: Player)
local profile = ProfileStore:LoadProfileAsync(“Player_”…player.UserId)
if not profile then
Players:Kick(KICK_MESSAGE)
return
end

profile:AddUserId(player.UserId)
profile:Reconcile()
profile:ListenToRelease(function()
	Manager.Profiles[player] = nil
	Players:Kick(KICK_MESSAGE)
end)

if player:IsDescendantOf(Players) == true then
	Manager.Profiles[player] = profile
	CreateLeaderStats(player)
else	
	profile:Release()
end

end

for _, Player in Players:GetPlayers() do
task.spawn(LoadProfile, Players)
end

Players.PlayerAdded:Connect(LoadProfile)
Players.PlayerRemoving:Connect(function(Players)
local profile = Manager.Profiles[Players]
if profile then
profile:Release()
end
end)

Yeah, when you are putting the code put “```” at the top and bottom of the code.