Reduce lags from raycasting

So I wanna make a function with a bunch of raycasting but it lags too much. Any ways to fix this?

Continue to help post