Leader board and player data script not working

local players = game:GetService("Players")
local serverscriptserivce = game:GetService("ServerScriptService")

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


local ProfileStore = ProfileService.GetProfileStore("Production", Template)

local KICK_MESSAGE = "Data issue, try again shortly"
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 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

local function LoadProfile(player: Player)
	local profile = ProfileStore:LoadProfileAsync("player_"..player.UserId)
	if not profile then 
		player.Kick(KICK_MESSAGE)
		return
	end
	profile:AddUserId(player.UserId)
	profile:Reconsile()
	profile:ListenToRelease(function()
		Manager.profiles[player] = nil
		player.Kick(KICK_MESSAGE)
	end)
	
	if player:IsDecendantOf(Players) == true  then 
		Manager.profiles[player] = profile 
		CreateLeaderstats(player)
	else 
		profile:Release()
	end
end

for _, player in players:getPlayers() do 
	task.spawn(LoadProfile, player)
end

players.PlayerAdded:Connect(LoadProfile)
players.PlayerRemoving:Connect(function(player)
	local profile = Manager.profiles[player]
	if profile then 
		profile:Release()
	end
end)

This script is for data storing and leaderstats as well but it gives me an error code

if player:IsDecendantOf(Players) == true  then --shows error over here

and in the output it says

ServerScriptService.PlayerData.Data:36: attempt to call missing method 'Reconsile' of table

and the leaderboard does not work
iam following from a 10 month old tutorial so things might have changed i think, im not the best when it comes to scripting…

anyway, please help
Thanks -

I’m pretty sure the method is Reconcile

It still tells me that “IsDecendantOf” is not valid

Nowhere in the script is Players defined do you mean players it’s case sensitive.

image
it still gives an error here and in the output
even if i write “players” its an error

you didnt write “players” you write “player”.

nevermind im an idiot thank you
it worked

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.