How can I fix this? Coding help?

If I may suggest this version of the script. It’s smoother I think