Skip to content

Core Data Types

PlayerData

The main data structure for player information, based on your DefaultData module.

lua
export type PlayerData = typeof(DefaultData)

Example DefaultData structure:

lua
{
    Coins = 0,
    Level = 1,
    Experience = 0,
    Inventory = {},
    Settings = {
        MusicEnabled = true,
        SoundEnabled = true,
    },
    Plot = {
        Likes = 0,
        Size = 1,
        Buildings = {},
    },
    Stats = {
        TotalPlayTime = 0,
        GamesPlayed = 0,
        HighScore = 0,
    },
    Achievements = {},

    -- NEW: Leaderstats configuration
    leaderstats = {
        ["💰 Coins"] = "Coins",
        ["⭐ Level"] = "Level",
        ["👍 Likes"] = "Plot.Likes"
    }
}

Path Types

ValuePath

String type for dot-separated data paths.

lua
export type ValuePath = string

Examples:

lua
"Coins"              -- Top-level access
"Plot.Likes"         -- Nested access
"Settings.MusicEnabled"  -- Deep nesting
"Stats.HighScore"    -- Any depth
"Plot.Buildings.House.Level"  -- Complex nesting

ArrayPath

String type for paths to array/list data structures.

lua
export type ArrayPath = string

Examples:

lua
"Inventory"          -- Top-level array
"Plot.Buildings"     -- Nested array
"Achievements"       -- List of achievements
"Stats.RecentScores" -- Nested score array

DictPath

String type for paths to dictionary/table data structures.

lua
export type DictPath = string

Examples:

lua
"Settings"           -- Settings dictionary
"Plot.Buildings"     -- Building configuration
"Stats"              -- Player statistics
"Inventory.Equipped" -- Equipment slots

PlayerState - High-Performance Roblox Data Management