Hey People! 
I wanted to make an ID system for my script, and everytime a player joines he should get the less id, which is possible. 
On top at the script I define idtable as an array and above i start writing 0 in the first 200 fields. 
  
idtable = {} 
  
for x=1,200,1 do 
    idtable[x]=0 
end 
  
  
 
And in the PlayerJoinHandler, I have the giveplayerID(player) function, but the problem is, that the function didn't write the id in the idtable, the whole table stays at 0. Why? 
  
function givePlayerID(player) 
    local id = 1 
    local count = 0 
    local check=false 
     
    for i,v in ipairs(idtable) do 
        if v==0 and check==false then 
            id=i 
            check=true 
        end 
    end  
     
    idtable[id]=id -- Problem Row 
    setElementData(player,"player.id",id) 
end