2 ways to stop a repeat loop?

I’m working on a sliding script but I ran into this bug when I was trying to make them slide down a hill/wedge.

I used a repeat loop for making the player to go down a hill but I want 2 ways for the loop to stop and it doesn’t work if I have 2. Is there something I did wrong?

Here is my script:

There was also a error in the output:

attempt to index nil with 'Shape' indicates that hit2 is nil, which is very well possible if there is no ground for more than 10 stud below the player.

You can always use the keyword break to escape loops as well.

1 Like

I completely forgot breaks exist lol, thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.