Hi all, I was wondering a method to effectively fade out a ScreenGui and destroy it completely without accessing each item individually. This includes elements such as TextLabels, ImageLabels, Frames, etc. Here is my current code:
local function FadeGui(ScreenGui)
spawn(function()
local Transparency = 0
for i = 0, 1, 0.01 do
Transparency = i
ScreenGui.Backdrop.ImageTransparency = Transparency
ScreenGui.Backdrop.CloseButton.ImageTransparency = Transparency
ScreenGui.LoadingFrame.DescriptionFrame.BackgroundTransparency = Transparency
ScreenGui.LoadingFrame.DescriptionFrame.GameDescriptionFrame.CreatorLabel.TextTransparency = Transparency
ScreenGui.LoadingFrame.DescriptionFrame.GameDescriptionFrame.GameLabel.TextTransparency = Transparency
ScreenGui.LoadingFrame.ThumbnailFrame.BackgroundTransparency = Transparency
ScreenGui.LoadingFrame.ThumbnailFrame.Thumbnail.ImageTransparency = Transparency
wait(0.1)
end
end)
end
FadeOut(script.Parent)
Any help would be greatly appreciated, thanks!

4 comments
Use tables, Use GetChildren() function to the screengui and use it in a for i, v loop (use spawn function if needed)
I haven't made the even that triggers this script, you will have to do that, but i think this script can help you
local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait() local char = player.Character or player.CharacterAdded:Wait() local frame = script.Parent.Frame local title = GUINAME for i = 1, 0.5, -0.1 do GUIHERE.BackgroundTransparency = i title.Transparency = i wait(0.1) end
You might have to modify it a bit to get it to the way you like it, but i hope it helps :D