diff --git a/lib/statebags/client/client.lua b/lib/statebags/client/client.lua index 0668718..2c2c364 100644 --- a/lib/statebags/client/client.lua +++ b/lib/statebags/client/client.lua @@ -33,10 +33,10 @@ end ---@param callback function The callback function to handle changes (function(playerId, key, value, lastValue, replicated)) ---@return number handler The handler ID function ClientStateBag.AddPlayerChangeHandler(keyName, filter, callback) - return AddStateBagChangeHandler(keyName, filter and GetPlayerServerId(PlayerId()) or nil, + return AddStateBagChangeHandler(keyName, filter and ("player:%s"):format(GetPlayerServerId(PlayerId())) or nil, function(bagName, key, value, lastValue, replicated) local actualPlayerId = getPlayerFromStateBagName(bagName) - if DoesEntityExist(actualPlayerId) and (not actualPlayerId == PlayerPedId()) then -- you cant have a statebag value if you are not the player + if DoesEntityExist(actualPlayerId) and (actualPlayerId ~= PlayerPedId()) then -- you cant have a statebag value if you are not the player return false end if actualPlayerId and actualPlayerId ~= 0 then