Hi, DevForum Users,
Well, I’m trying to make a function that when user press a key (any), the childrens of the ScreenGui Tween with a fade effect. I’m aware that I can do all this manually like:
But I don’t want a messy code into my scripts, I’m trying to do it with a for loop, like
-- // Not my real code
local function Hide()
for _, v in pairs(ScreenGui:GetChildren()) do
if v:IsA('Frame') then
local X = TweenService:Create(v, TweenInfo, {BackgroundTransparency = 1})
X:Play()
elseif v:IsA('TextLabel') then
local Y = TweenService:Create(v, TweenInfo, {BackgroundTransparency = 1})
local Z = TweenService:Create(v, TweenInfo, {TextTransparency = 1})
end
end
end
But my script doesn’t work, I know maybe I’m not understanding good the for loops. plz help.