I apologize for no script since I feel that it would be more confusing. Below is a summary. Thanks.
I have a button that when activated, the local script inside the button communicates with a script in the ServerScriptService using a Remote Event and function x is ran. There’s a while loop in function x. When I press another button, I want to make the loop in function x stop and run function y which has a while loop in the same script.

1 comment
You need a condition to make the loop stop. Try restructuring your code.