Skip to content

SetSavedData

Saves a value on the player’s name - it is there on their next visit.

Strings (a number is converted); nil removes the key. Written into the player’s record with the visits and the position; for a registered name, only when its owner is logged in.

SetSavedData(pid, key, value)
Parameter Type
pid number the player
key string the key
value string | nil the value; nil removes the key

boolean - false when not connected

function OnPlayerDeath(pid, attacker)
if attacker >= 0 then
SetSavedData(attacker, "wins", (tonumber(GetSavedData(attacker, "wins")) or 0) + 1)
end
end

GetSavedData · GetSavedPlayer · SetServerData · the Storage and persistence group of the index