Connecting to a Specific Property Through Instance.Changed

Oh, I am/was working on a new gen admin script, which included me testing it a lot in oxsb.
Since it consisted of modulescripts, it was tricky to stop a version and run a new one.
So I created a command that disconnects all events created that way… if it works…

I never understood why people don’t just use ROBLOX Studio

I did do something like that for testing plugins. What if you destroy the script that requires the ModuleScript, does it disconnect?

Doing it online in a SB (with other people) was way more fun, and allowed me to test more.
(Like if permissions worked for other players etc)
(And I was the only one who could break the sandbox, so eh, fun)

When you require a MS, it’s basicly a new script that runs.
The value that it returns is returned by require.
The modulescript has no idea who required it, nor can it influence that script in any way.
(Except yielding forever in the MS’ main thread, which makes require also yield forever)

So no, destroying the script that required it (or even the MS for that matter) doesn’t work.
(Actually destroying the MS might do something, but it’s very weird and has memory leak-ish stuff)

That’s only if you’re connecting to events from the modulescript’s block.
If your script calls a function that a module returns, and that function connects to stuff, destroying the script will disconnect the event.

Ideally it would just disconnect stuff when you destroyed the moduleScript :stuck_out_tongue:

If I have a singleton module, I usually give it a dispose method, as for objects, I create things by calling their constructor function.

I think we’re getting a tad off topic lol

Yes, since the connections are linked to the script by the thread that connected the event.
(Not sure how accurate that is, is it really linked to the thread by who created it, or who’s running it?)
But I require several submodules that do stuff… the only normal script is the one requiring the main module.
(In a genius way in order for me to be able to update the modulescripts and rerequire it in the same server)

I’m not the only person that only has 1 Script and 1 LocalScript? x)

Apparently I can say the same.
(Although I assumed I wasn’t the only one)

(me too, I was just being a little sarcastic)

We are officially super off-topic now :joy:

1 Like