I am just wondering which statement is more efficient and recommended to use. I don't care about the code, I just want to know for future reference which way is better.
1:
if game.Players[spawnNPC.Data.Owner.Value].Days.Value < 3 then foodToChoose = tier_1_tab end if game.Players[spawnNPC.Data.Owner.Value].Days.Value < 5 then foodToChoose = tier_2_tab end
2:
if game.Players[spawnNPC.Data.Owner.Value].Days.Value < 3 then foodToChoose = tier_1_tab elseif game.Players[spawnNPC.Data.Owner.Value].Days.Value < 5 then foodToChoose = tier_2_tab end
The 2nd one. But you would have to check the higher numbers first,
if game.Players[spawnNPC.Data.Owner.Value].Days.Value < 5 then foodToChoose = tier_2_tab elseif game.Players[spawnNPC.Data.Owner.Value].Days.Value < 3 then foodToChoose = tier_1_tab end
So basically, if that value is higher than 5, no need to check for 3. If its not higher than 5, then check the next statement.