How to code mouse sensing (dont copy the backround)

this is one of the only things I know how to code.
make a sprite (not a background) and then add a background picture must be full like this

then add
when flag clicked
set size to 130%
go to x:0 y:0
Forever
go to x: add a max block on the x and add the min block at the first space in max and add an / block at the last space of the min block. add mouse x and put it in the / block at the first space and at the right side of the / block add -1. when you see the first space open in the min block add 170 and at the max side add -170

FNAF 1 script pic

And your done.

That's interesting, but here's a simpler script: