Skip to content

Leaderstats Types ​

LeaderstatsConfig ​

Configuration type for automatic leaderstats integration.

lua
export type LeaderstatsConfig = {
    [string]: ValuePath  -- Display name -> data path
}

Example:

lua
local leaderstatsConfig: LeaderstatsConfig = {
    ["💰 Coins"] = "Coins",
    ["⭐ Level"] = "Level",
    ["👍 Likes"] = "Plot.Likes",
    ["🏆 High Score"] = "Stats.HighScore"
}

Notes:

  • Keys are the display names shown in leaderstats
  • Values are paths to the actual data
  • Supports nested paths with dot notation
  • Numbers automatically use IntValue, others use StringValue
  • Order in the player list is set by PlayerStateConfig.Server.LeaderstatsOrder (a list of these display names); stats not listed follow alphabetically. Without it, the order is alphabetical.
  • A stat keeps its position when its value switches between whole and decimal numbers.
lua
-- PlayerStateConfig.lua
Server = {
    LeaderstatsOrder = { "💰 Coins", "⭐ Level" },
}

PlayerState - High-Performance Roblox Data Management