I’m making an RPG project, and I have some labels that I want to make update (level, power points, ect).
But, I’m not sure how.
I have these 3 functions in my handler, as of now.
function Handler:Get(player, key)
local profile = getProfile(player)
assert(profile.Data[key], string.format("Data does not exist for: %s", key))
return profile.Data[key]
end
function Handler:Set(player, key, value)
local profile = getProfile(player)
assert(profile.Data[key], string.format("Data does not exist for: %s", key))
assert(type(profile.Data[key]) == type(value))
profile.Data[key] = value
end
function Handler:Update(player, key, callback)
local profile = getProfile(player)
local oldData = self:Get(player, key)
local newData = callback(oldData)
self:Set(player, key, newData)
end