How do I tween transparency with all childs of a GUI frame?

So, I want to tween the transparency of a frame and it’s children with it.

The error I’m getting it just tweens the background and not all of it’s children.
(which makes sence)

Code (Local Script)

-- Service --
local TweenService = game:GetService("TweenService")
-- Locals --
local TopBar = script.Parent.Parent.Background.TopBar
local BellButton = TopBar.BellButton
local notificationFrame = script.Parent.Parent.Background.notificationFrame
-- Bell Button --
local TweenVisible1 = TweenService:Create(notificationFrame, TweenInfo.new(2), {Transparency=1})
local TweenVisible2 = TweenService:Create(notificationFrame, TweenInfo.new(2), {Transparency=0})

BellButton.MouseButton1Click:Connect(function()
	if notificationFrame.Transparency == 0 then
		TweenVisible1:Play()
		TweenVisible1.Completed:Wait()
		TweenVisible1:Pause()
	else
		TweenVisible2:Play()
		TweenVisible2.Completed:Wait()
		TweenVisible2:Pause()
	end
end)
1 Like

Currently you will need to iterate through all descendants of the frame and create a transparency tween for anything that IsA GuiObject. In the future, you will be able to use a CanvasGroup to apply multiplicative transparency to all GuiObjects assigned to that CanvasGroup and you’ll only need to tween the transparency of the group rather than the individual elements.

10 Likes

I just want to add, there’s no point in pausing an already completed tween.