Is setting a connection to nil the same as disconnecting it?

Im curious because I have connection that runs until something else happens and I was wondering if I could just set the connection to nil and it will not cause any problems?

2 Likes

That’s redefining the variable, not changing the connection. So no, it’s not the same.

Then explain to me why if I change connection to nil and I try to disconnect it, it errors?

Because the connection is nil and doesn’t understand what the connection is anymore. Think of it like this: If you have a TextLabel in a variable and set the variable as nil, the TextLabel still exists, does it not?

1 Like

Wow @jasperagent_dev you be thinking outside of the box sometimes man, thanks I get it, so always disconnect and THEN set it to nil right?

Yup, you got it. Character limit filler

1 Like

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