SetData||doc136345

September 20, 2022

Format

RankDataStore:SetData(key, value)

Describe

Set the value on the corresponding key of leaderboard data. Only integer value can be set. If it is not an integer, it will try to convert it to an integer.

parameter

Variable name Type Describe
key string key
value int value

The stored key string cannot contain ":" or "#", otherwise the storage will fail

Code example

Set the combat power of three players in the "player combat power" leaderboard data.

local playerPowerData = Engine.DataService:GetRankDataStore("PlayerPower")
playerPowerData:SetData("Player_A", 1200)
playerPowerData:SetData("Player_B", 5600)
playerPowerData:SetData("Player_C", 1800)