It happens that when they register they have not played yet, therefore that data does not yet exist.
To solve it you can do it in two ways.
1. Force to start for the first time with elementData at 0
addEventHandler("onPlayerLogin", root, function(pa, ca)
local account = getPlayerAccount(source)
if not isGuestAccount(account) then
local health = getAccountData(account, "health") or 0
local armor = getAccountData(account, "armor") or 0
local water = getAccountData(account, "water") or 0
local food = getAccountData(account, "food") or 0
setElementHealth(source, health)
setPlayerArmor(source, armor)
setElementData(source, "water", water)
setElementData(source, "food", food)
end
end)
or directly in the hud set it to 0 if you don't already have those elementData
function render()
health = getElementHealth(localPlayer)
armor = getPedArmor(localPlayer)
water = getElementData(localPlayer, "water") or 0
food = getElementData(localPlayer, "food") or 0
money = getPlayerMoney(localPlayer)
time = getRealTime()
hour = time.hour
minute = time.minute
second = time.second
...