function PlayerDataHandler:Update(player, key, callback)
local profile = getProfile(player)
local oldData = self:Get(player, key)
local newData = callback(oldData)
if player.leaderstats:FindFirstChild(key) then
print(key)
player.leaderstats:FindFirstChild(key).Value = key
end
self:Set(player, key, newData)
end
return PlayerDataHandler
Im guessing you also watched dot products tutorial on setting up profile service. I think in your case it would be more appropriate to use :Set instead of update
can you paste the lines of code that you are getting these errors from. My guess is that its from :set since it looks pretty similar to my :set
function PlayerDataHandler:Set(player, key, value)
local profile = PlayerDataHandler:getProfile(player)
assert(profile.Data[key], string.format("Data does not exist for key: %s", key))
assert(type(profile.Data[key]) == type(value))
profile.Data[key] = value
end
You should double check that chosenElfName is a string using print(typeof(chosenElfName)