Move the stick over the fire to roast it. When you get it to a color you like (my favorite is burnt), press space to eat it. There are 6 stages: raw, warmed, golden, well-done, black, and burnt.
The fire does die overtime, but you can relight it by clicking the green flag. Also, you'll have to click the green flag until the marshmallow is white instead of very light gold. There's a weird glitch that does that.... Thanks to @CrownTech and @ExperienceSea, @CrownTech for the fire script (which I modified), and @ExperienceSea for the idea to make this.