Arduino crashes with seemingly really easy code

I'm trying to make a simple script that turns on a motor on a nerf blaster for a certain amount of time with a switch (fire) and choose the amount of time with another switch (button).
But it keeps crashing, which means the motor stays on or off until you reset the arduino and I can't seem to figure out why.

The arduino is powered by a 3s lipo, charged under 12V and powers an IRLB3034PBF mosfet.

newstryfe.ino (1.01 KB)

Please POST the code.

Please follow the advice on posting code in Read this before posting a programming question

In particular note the advice to Auto format code in the IDE and using code tags when posting code here

How much current does the take when it is running ?

How is everything wired up? A schematic (even hand drawn) would be useful. Do you have pull-up resistors on your inputs? Do you have any sort of diode across your motor to prevent spikes? It sounds a lot like you are seeing power spikes or dips which is resetting your board.

Switching large motor currents causes EMI, which, if not properly suppressed, will cause problems with sensitive digital circuits. Post a wiring diagram.