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.
script.Parent.MouseEnter:Connect(function()
print("Hi")
connection = Items.Sword.MouseButton1Down:Connect(function()
print("Hi2")
end)
end)
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

2 comments
Are you sure it's not because you're holding down the mouse?
I don't think its the issue. The script i put on this post is not similar to the one i wrote on studio. My issue is that if i run mouse enter 5x times. It creates 5 instances of mousebutton1down. But i only want it to create 1 instance no matter how many times mouseenter fires