Need help with a hud error - bad argument #1 to 'for iterator' (table expected got nil)

On server start, the hud doesnt show any info of a player, the same is when a player joins the server, but once i restart the script it works and no error comes up. Anyone know how to fix this?


I think the error happens because there is no table data yet. Either put it in an if branch before the for loop and skip the whole for loop so that as long as there is no data in the ESX.GetPlayerData().accounts table or no data at all, the script part doesn’t run. That’s why if you restart the resource it might work fine.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.