# I need help plz thanks if you do im a beginner sorry

**URL:** <https://discourse.processing.org/t/i-need-help-plz-thanks-if-you-do-im-a-beginner-sorry/49230>\
**Category:** Beginners\
**Tags:** homework\
**Created:** [August 21, 2026, 2:17am UTC](https://discourse.processing.org/t/i-need-help-plz-thanks-if-you-do-im-a-beginner-sorry/49230 "2026-08-21T02:17:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chuudtaco](https://avatars.discourse-cdn.com/v4/letter/c/ce73a5/32.png) [@chuudtaco](https://discourse.processing.org/u/chuudtaco)\
**Post date:** [August 21, 2026, 2:17am UTC](https://discourse.processing.org/t/i-need-help-plz-thanks-if-you-do-im-a-beginner-sorry/49230/1 "2026-08-21T02:17:05Z")

</div>

hi I don’t know why my keyPressed isn’t working, I copied and pasted references and they don’t work either, i’m not sure if it’s a me problem.

[https://editor.p5js.org/chuud/sketches/FtKfFDUL5](https://editor.p5js.org/chuud/sketches/FtKfFDUL5)

sorry if i used wrong format i’m not sure how to use it

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [August 21, 2026, 3:15am UTC](https://discourse.processing.org/t/i-need-help-plz-thanks-if-you-do-im-a-beginner-sorry/49230/2 "2026-08-21T03:15:04Z")

</div>

> [@chuudtaco](#):
>
> I don’t know why my keyPressed isn’t working

keyPressed() is a separate function and should not be inside the draw() function. Move it to below where you ended the draw() function and it should work.

---

<div class="post-metadata">

**Author:** ![sterretje](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@sterretje](https://discourse.processing.org/u/sterretje)\
**Post date:** [August 21, 2026, 5:41am UTC](https://discourse.processing.org/t/i-need-help-plz-thanks-if-you-do-im-a-beginner-sorry/49230/3 "2026-08-21T05:41:25Z")

</div>

It’s often easier to spot mistakes if you indent your code properly. I don’t use p5.js but saw the below when I clicked _Edit_

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/7/5/75fc9eb5f70306369409dd8fa097baf69442b385.png)

It will not fix the errors but as I said they would be easier to spot once you know what to look for. E.g. after _Tidy code_ the keyword `Function` should be at the beginning of a line.
