[I am making a game with a friend for school, we only want the character to jump only when on a platform. This works, but sometimes it will not let you jump.]
Using an Or and an AND inside a conditional creates a lot of moving parts.
Also, keyDown probably would work better than keyWentDown.
I would probably start by using only the up key to jump and removing the or statement. Then, use keyDown instead of keyWentDown … then, if you are still having problems, check back in!
That could be the “fall” function that is constantly changing the velocityY. It could be that it doesn’t stay at zero long enough for the jump to happen, but I’m not 100% sure. You may try moving the jump function below the fall function and see if that changes anything.