That's not the error you reported, you said it was counting up infinitely. Looks like you don't call the achievements function ever in the events. You have to call the function to set the values in the array, from what I can see they will always be 0. It displays 0 achievements because you actually have 0 achievements, check what the array is doing in debug menu.