Need help making a fade

added you to team create, thanks for helping me!

Done. You’re welcome. :slight_smile:

local TweenService = game:GetService("TweenService")
local Gui = script.Parent

Gui:WaitForChild("main"):WaitForChild("topbar"):WaitForChild("close").MouseButton1Click:Connect(function()
	for _, gui in pairs(Gui:WaitForChild("main"):WaitForChild("topbar"):GetChildren()) do
		if gui.Name ~= "UICorner" then
			TweenService:Create(gui, TweenInfo.new(0.5), {BackgroundTransparency = 1}):Play()
			TweenService:Create(gui, TweenInfo.new(0.5), {TextTransparency = 1}):Play()
		end
	end
	TweenService:Create(Gui:WaitForChild("main"), TweenInfo.new(0.5), {BackgroundTransparency = 1}):Play()
	TweenService:Create(Gui:WaitForChild("main"):WaitForChild("topbar"), TweenInfo.new(0.5), {BackgroundTransparency = 1}):Play()
end)

PS - If you need the speed of the fade changed, let me know. :heart:

PSS - You can test it yourself.

local function Tween(Object:Instance,Duration:number,Goal:table)
  game:GetService("TweenService"):Create(Object,TweenInfo.new(Duration),Goal):Play()
end

I usually use functions to tween and i think u should too! it makes code much more clean also to try the function above just do this

Tween(urobj,1,{urproperty = urvalue})

thank you so much! by the way, do you think you can make it fade faster

alrighty, thanks! charsssssssssss

How’s that? charsssssssssssssssssss

perfect! thanks

charsssssssssssssssssssss

1 Like

No problem, be sure to make my post as solution as I solved your issue.

there you go, thank you!
characters

1 Like

you could get all the objects inside the main thingy by using :GetDescendants() it returns all the objects in a table that is inside the main thingy which you could loop so you get all each objects

and then specify the object if it is a gui by using statements and check using :IsA()
after that you can now tween the object

also since you just going to delete the main thingy at last you could just call the event once using :Wait()

local main = script.Parent.Parent.Parent

script.Parent.MouseButton1Click:Wait()

main.Active = false

for _, Object in pairs(main:GetDescendants()) do
	if Object:IsA("GuiObject") then
		game.TweenService:Create(Object, TweenInfo.new(0.5), 
			{
				Transaparency = 1
			}
		):Play()
	end
end

main:Destroy()