I have a 114 line Local script that in placed inside a frame inside the StarterGui. Also within the frame, there are about 10 different values.
What I do is duplicate the frame, and change all the values, but the script stays the same. So, my script is inside the frame, and gets duplicated with the frame, because it needs to access its siblings values.
I’d say there will be about 300 or more frames. So, If i need to change the script, I’d end up having to change all 300. What do I do instead? I looked into module scripts, but I’m not completely sure how I would do a bunch of functions, or how i would deal with occurrences of “script.parent”. In the script, almost everything is script.Parent.Parent…
How do I go about this? Please help.
If I’m being honest, I don’t know how you could do something like this, BUT ModuleScripts would be most efficient, at least if I was doing this. Try using a variable for script.Parent
, though. Hope this helped!
Why don’t you post your code? It is much easier to see what is going on and help you fix your problem if we can see your specific situation in more detail.
Do a for i,v in pairs loop for all of the frames instead of having a separate script for all the frames.
Use loops as ThousandDegreeKnife said, also if your script gets too big or you end up duplicating functions then you should use ModuleScripts to avoid duplicates.
you shouldn’t really be using scripts that much, module scripts are the way to go because it allows for code to be more maintainable and efficient.
I didn’t realize that functions like mouse click still work inside loops! Thanks.
I didn’t think of this, thanks!