GameState bug...

I am encountering a strange bug with game states…

I make gameState=0 in setup, then In draw for the start menu I add

if gameState==0 then
*code*
end

It works the first time, but then when I try to play the program again it gives a black screen… only when I duplicate the project will it work one more time then bugs again. Anyone else encountered this?

I have found that to fix it I have to do

If gameState == 0 then
end
*code*

but that isn’t how it should work… and will probably not work if I export to Xcode…

This never happened in the 2 previous games that I made…

Anyone seen this and know what is going on?

lol wow didn’t notice that… Thanks for the help! I feel dumb…

Removing the code

@Crumble All of your code is in the function setup(). You’re missing an end statement on the “if readLocalData”.

Edit: thanks

@Crumble - can you create a small test program that produces this behaviour, and post it?