Just made it without that math stuff that makes 0 sense and added My blocks to make some code easier to understand.
Thanks to @Cranberry-Animations for the code without the math.