Does constantly putting out touched connections cause performance issues?

I have a simple question:
If I have a script along the lines of this

function touch()
script.Parent.Touched:Connect(function(){
something here
}
end

If mouseClicked(or something) then

touch()
end

Will that affect my performance?
In other words, will running a touched event in a function for every action stack over time and harm performance?
If it does harm my performance, will disconnecting it help? Or if not is there any other way?

Thanks

In short, it won’t hurt your performance.

Like everything else in the world, too much can be bad, i.e. having an excessive amount of touched events which can be replaced by other systems. Another issue you’ll see though is the lack of organisation, and if you want to make a simple change you’ll have to sift through hundreds of scripts.

I would just like to say though that for your code, you shouldn’t be putting the Touched event within the function, and instead putting the function inside the Touched event, as such:

function OnTouch()

   print("hello")

end

script.Parent.Touched:Connect(OnTouch)


There is a slight performance loss. Having a lot of events running would cause some performance issues.

Image from here: BasePart.CanTouch

Thanks for the reply. I am aware of that fact. However, my circumstances require that I put the event inside the function(I am making an ability system, including animated abilities. Each ability is sorted into a function in a list.) My main question still remains: Say I were to have a while loop constantly adding 10 touched events per second. Will the touched events stack and wreck the performance, or is Lua smart enough to replace it?

I know lots of events causes performance issues. But what about lots of events stacked together, as in my example?

Can you elaborate more on what you mean by “stacked”?

If I run the code which “deploys” the event multiple times, in one script, on one part, doing one thing, will they all register?

Hmm I don’t know. My brain is small sorry.