So basically, long story short, i made a sidebar ui and it has tons of variables for each instance (frame, canvas group, uilist layout, etc) and it would be a pain to manually set these back to their original state to close the bar, so instead i resorted the fading it out, deleting the canvasgroup instance that holds the entirety of the ui (doesnt include the script) and cloning it back into screengui
It works to perfection, except that my variables are stuck to the old instance and not the new cloned one
I feel like its an easy fix but im not too sure what to do
While there are solutions, I don’t particularly recommend any of them.
It would be best if you properly reset the original UI, instead of cloning a new one.
If you insist that it must be done like this, you would have to either manually set each variable to it’s new value by indexing into the cloned UI, or alternatively, you might be able to achieve some form of atomization using getfenv
(However this may significantly reduce the performance of your code).
By reseting the original ui, what do you mean ?
Deleting the entirety of the screengui (script included) ?
I mean setting the properties of the UI back such that it appears the same as the UI did to begin with.
But thats what i wish to avoid since it seems like a pain
But i think i got an idea
Basically, i would delete the gui entirely after fading, launch a remote to the server, then clone the gui from ReplicatedStorage into the player gui
Would that work ?
I know you are trying to avoid that, but what I am trying to convey is that while it might seem like a pain, it is still far preferable to any workaround you would find.
i found a better solution, since my script was located in a seperate place other than the gui itself, i made a thread for each time the gui gets cloned and removed the old thread, it isnt very performant but it removes any bugs with the old instance and works much faster than i expected
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.