I couldn’t find a (decent) module to perform the task of setting a GUI’s (the gui object + all descendants) transparency, so I made one myself.
Why would you want to use this?
An example case would be fading a whole frame in to display information (that’s right! it utilises the TweenService), and then out again after:
As seen in the above GIF, it works with TextLabels, semi-transparent objects (relative to that objects default/cached transparency). Also works with images!
I have provided some small documentation in the module but it’s very basic!
local GUITransparency = require(module)
GUITransparency:SetTransparency(object, transparency[, TweenInfo])
As you can see the TweenInfo is optional, if you don’t include it the transition will be instant
You can also do GUITransparency:Revert(object) to revert the object back to it’s default transparency!
Any bugs/suggestions let me know below, I quickly made this so I’m sure it’s not perfect and there could be other things I could add/do to optimise it
Of course you’re free to edit & republish this module as you please as it’s fully open source.
I’ll update it with any worthwhile suggestions I get over time, or any other features I see fit
Wow, thank you for creating this! I’ve always found it very annoying to simultaneously fade the transparency of multiple objects. This module is going to be of great help to me as well as many other developers!
Well, I cannot say that it’s not useful, but look at the code, it has so many lines!
This is very useful for beginner scripters, but more advanced ones can just use :GetDescendants() and do it. And to get the transparencys you put them all in the table. So the script would look somewhat like this:
local TransparentObjects = {}
--make transparent
for i, v in pairs(frameObject:GetDescendants()) do
if v:IsA("Frame") or ... then
table.inset(TransparentObjects, v.Transparency)
-- Tween
end
end
True, however the point of this module was to be able to tween TextLabels, ImageLabels/Buttons, Frames, etc. simultaneously without having to write it out for each object’s case (TextTransparency, BackgroundTransparency, etc.)
Being only 92 lines long, having a simple revert function, caching, “relative-per-object transparency” and a one line function to do what you have written out I believe it’s a suitable module. Of course, it’s personal preference!