When I have a function inside of a function I get this strange loop. Why does this happen?
Hello fellow reader, I simply have a question about functions. I am having this issue where if I have a function inside of a function, I get this type of loop where if I run function-MouseEnter around 5 times. It of course prints("Hi") 5x times. But if I then run function-MouseButton1Down 1x time. Then function-MouseButton1Down gets fired 5 times. Even though I ran it only 1 time. And if I run function 2 again it runs 5 times instead of only one.
1 | script.Parent.MouseEnter:Connect( function () |
3 | connection = Items.Sword.MouseButton 1 Down:Connect( function () |
Could someone explain how to end the loop? I am really confused about functions so please tell me if there was something you didn't understand. It's kinda hard to explain this certain problem but its crucial for me to fix. Any help would be thanked