Raycaster lag

ive made a very basic and laggy raycaster, but i need help making it less laggy. ive tried using different scripts. but they dont really work. heres a project link: raycast 0.1 by mrace0 | Snap! Build Your Own Blocks

The two reasons I can see, is that your FOV block is doing everything at once instead of firing a ray into a wall and then starting again.

Also the To block in sensing has a ray length option built in as well, so instead of doing it manually, you could probably experiment with that as well.

Also, you probably want movement to be seperate from the main loop because as it stands it’s checking for movement and then rendering, which probably isn’t helping either.