

ModuleScript for reusable modules that can be included in server or client scripts. LocalScript for scripts that can run on a client. Local function ancestr圜hanged(uiClone, newParent)Ĭonns = uiClone. Roblox has three types of scripts: Script for scripts that can run on the server.

If you use a table that contains all connections, you only need to declare it before the function.Īnother version of UIControl local allConns = If you make a separate variable for every connection, you’ll need to declare all those variables before the function declaration and update them in the function. The ancestrychanged function can also be created above the return function as long as the variables it needs and doesn’t get from the event are declared before it. If you create many connections, you can also store them in a table. Local conn2 = anotherEvent:Connect(anotherFunct)Īncestr圜onn = uiClone.Ancestr圜hanged:Connect(function(_, newParent) Local conn1 = someEvent:Connect(someFunct) Your UIControl module in ReplicatedStorage could look like this.

I’m interested in creating a fighting game with abilities and during my researches I found this thread: I read the code in the file attached in the answer I linked, but I didn’t quite get how it works. Require(ReplicatedStorage.-])(UIClone, 'Stuff') Hi I’m currently experimenting with module scripts and OOP, but I don’t quite understand certain aspects. local ReplicatedStorage = game:GetService("ReplicatedStorage")
