#Leader stats aren't showing up on leaderboard

45 messages · Page 1 of 1 (latest)

grand willow
#

I don't know why my values for slashes and gems aren't showing up as leader stats, Could anybody please tell me why?

Data Code:

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("Production", Template)

local KICK_MESSAGE = "Data issue, try again later. If the issue persists please contact us!"

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 Slashes = Instance.new("NumberValue", leaderstats)
    Slashes.Name = "Slashes"
    Slashes.Value = profile.Data.Slashes
    
    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:Reconcile()
    profile:ListenToRelease(function()
        Manager.Profiles[player] = nil
        player: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, player)
end

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

Continued, Script in ServerScriptService : ```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("Production", Template)

local KICK_MESSAGE = "Data issue, try again later. If the issue persists please contact us!"

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 Slashes = Instance.new("NumberValue", leaderstats)
Slashes.Name = "Slashes"
Slashes.Value = profile.Data.Slashes

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

end```

#

Script in StarterPlayer: ```local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Remotes = ReplicatedStorage.Remotes

UserInputService.InputBegan:Connect(function(input, processed)
if processed then return end
if input.UserInputType == Enum.UserInputType.MouseButton1
or input.UserInputType == Enum.UserInputType.Touch
or input.KeyCode == Enum.KeyCode.ButtonR2 then
Remotes.Slash:FireServer()

end

end)```

inland flowerBOT
#

studio** You are now Level 1! **studio

sage tide
#

A value that only takes numbers would be IntValue

grand willow
sage tide
#

So replace all the NumberValue with

#

IntValue

grand willow
#

My output says this

sage tide
#

Thats something in the scripts your requiring then

inland flowerBOT
#

studio** You are now Level 2! **studio

sage tide
#

cause that shows line 306?

#

and the ones you sent are that long

grand willow
sage tide
#

_listener = listener,

grand willow
inland flowerBOT
#

studio** You are now Level 1! **studio

grand willow
#

could you correct the code for me please

sage tide
#

ok

#

send it in here

#

the script_connection code

#

lines 304-312

grand willow
#

alr

#

local script_connection = {
_listener = listener,x
_script_signal = self
_disconnect_listener = disconnect_listener,
_disconnect_param = disconnect_param,

        _next = self._head,
        _is_connected = true,
    }
#

ty

sage tide
#
local script_connection = {
            _listener = listener,
            _script_signal = self
            _disconnect_listener = disconnect_listener,
            _disconnect_param = disconnect_param,

            _next = self._head,
            _is_connected = true,
        }
#

try that

#

and fix indentations if needed

grand willow
sage tide
#

tell me if it works

grand willow
#

on the disconnect listener line it shows this

sage tide
#

oooh

#

my bad

#
local script_connection = {
            _listener = listener,
            _script_signal = self,
            _disconnect_listener = disconnect_listener,
            _disconnect_param = disconnect_param,

            _next = self._head,
            _is_connected = true,
        }
#

now try

#

i forgot a comma

#

also whats with all the modules

#

couldnt you maybe just create a simple script inside of serverscript service? or no

grand willow
#

idk this was from a plugin

#

for adding constraints

#

it works now thank you so much