So I have already accomplished the first part with having my buttons fade upon clicking it, but how could I go about fading EVERYTHING inside of the UI? I have organized my UI to make it more visually friendly for myself, but it’s becoming a struggle trying to get everything to work how I am wanting it to.
This is what it does thus far. Below is the code for this:
-- Variables --
local playB = script.Parent.PlayButton
local optionB = script.Parent.OptionsButton
local storeB = script.Parent.StoreButton
local creditsB = script.Parent.CreditsButton
-- Play Button --
playB.MouseButton1Click:Connect(function()
for i, v in pairs(script.Parent:GetChildren()) do
if v:IsA("TextButton") then
coroutine.wrap(function()
for i = 0, 1, 0.1 do
v.BackgroundTransparency = i
v.TextTransparency = i
wait(.1)
end
end)()
end
end
end)
This is the structure for the inside of my UI to help give a better understanding of what I am wanting to accomplish:
I have attempted to get rid of the folder and just have everything under the StarterGUI and bare with it, and I’ve also tried hard coding the slider and the title in my script so that I could achieve this, but it doesn’t go at the same time. That is why I used the coroutine.wrap function so I could have everything going at the same time for a fairly smooth transition.
and does not work because a TextButton can’t be a TextButton and Frame at the same time.
In your script, you were only turning TextButtons’ transparency to 1 with if v:IsA("TextButton"), but with if v:IsA('TextButton") or v:IsA("Frame"), it gets turns TextButtons, or Frames’ transparency to 1
Thank you so much, I have a much better understanding now. What I did now is I just removed the folder and dumped everything into the starterGUI since it made the whole process a bit easier.
playB.MouseButton1Click:Connect(function()
for i, v in pairs(script.Parent:GetDescendants()) do
if v:IsA("GuiObject") then
coroutine.wrap(function()
for i = 0, 1, 0.1 do
v.BackgroundTransparency = i
v.TextTransparency = i
wait(.1)
end
end)()
end
end
end)