Skip to content

Batch Operation Types ​

BatchOperation ​

Type for individual batch operations used in BatchSetValues().

lua
export type BatchOperation = {
    path: ValuePath,
    value: any,
}

Example:

lua
local operations: {BatchOperation} = {
    {path = "Coins", value = 1000},
    {path = "Level", value = 5},
    {path = "Plot.Likes", value = 50},
    {path = "Settings.MusicEnabled", value = true}
}

BatchUpdateOperation ​

Type for increment/decrement operations used in BatchUpdateValues().

lua
export type BatchUpdateOperation = {
    path: ValuePath,
    operation: "Increment" | "Decrement",
    amount: number?,
}

Example:

lua
local operations: {BatchUpdateOperation} = {
    {path = "Coins", operation = "Increment", amount = 100},
    {path = "Lives", operation = "Decrement"},
    {path = "Plot.Likes", operation = "Increment", amount = 5}
}

LeaderboardEntry ​

Type for leaderboard entries returned by leaderboard functions.

lua
export type LeaderboardEntry = {
    userId: number,
    score: number,
    rank: number,
}

Example:

lua
local leaderboardEntry: LeaderboardEntry = {
    userId = 123456789,
    score = 1500,
    rank = 1
}

-- Leaderboard array
local leaderboard: {LeaderboardEntry} = {
    {userId = 123456789, score = 1500, rank = 1},
    {userId = 987654321, score = 1200, rank = 2},
    {userId = 555666777, score = 1000, rank = 3}
}

LeaderboardInfo ​

Type for the local player's leaderboard info synced to the client.

lua
export type LeaderboardInfo = {
    rank: number?,
    score: number?,
    statName: string,
}

Notes:

  • This is derived from the replicated _LeaderboardRanks table.
  • It is temporary display data and is not intended to be saved into player data.

PlayerState - High-Performance Roblox Data Management