I want my WHOLE GUI to fade in when a function is called. It’s not possible to make the Transparency of the frame from 1 to 0 for the elements in it to also fade in.
How would I achieve this without needing the reference every element in the frame and change their transparency.
Yeah, this is the method I am familiar with; I don’t think there’s a simple function or method that allows you to change transparency without referencing the elements at all (via a loop or anything). A loop over descendants definitely works. Only minor tweak I would make is as follows, depending on what you want:
If you want to basically link the transparency of all the inner elements to the main frame at all times, you should do this:
for _, elmement in ipairs(frame:GetDescendants()) do
if element:IsA("GuiBase2d") then
frame:GetPropertyChangedSignal("Transparency"):Connect(function()
element.Transparency = frame.Transparency
end)
end
end
If you want to only change the transparency at particular times, you should do this:
local function decreaseOpacityOf(element: GuiBase2d)
-- Logic to decrease the opacity; maybe via a tween or just instantaneously
end
local function decreaseOpacityOfAllElements(frame: Frame)
decreaseOpacityOf(frame)
for _, element in ipairs(frame:GetDescendants()) do
if element:IsA("GuiBase2d") then
decreaseOpacityOf(element)
end
end
end