I’m making a tween fade effect for closing and opening a shop menu.
The 2 text buttons inside the purchases frame are supposed to fade their transparency at the same time, turns out the next one fades it a little later. Here’s what I mean: https://gyazo.com/22492d163e39b72b68293a18eb46c0f2
Parents: https://gyazo.com/c5c9a6dd68f5a7b8f041f8b44f82ee3f
I’ve tried removing the wait cooldown between the buttons fading and then the shop gui coming up, that didn’t work either.
Code:
local Screen_UI = script.Parent.Parent
local Client__ = Screen_UI.Client
local Tween_Service__ = game:GetService("TweenService")
local __Buttons_ = Client__:WaitForChild("Buttons")
local Player = game.Players.LocalPlayer
local Remotes__ = game.ReplicatedStorage.UIRemotes
local TopBarMenu_Opened = false
local TopBarWindow = Client__.TopBar.TopBarWindow
local Tween_Info = TweenInfo.new(0.3, Enum.EasingStyle.Linear)
local Purchases = script.Parent.Parent.Client.TopBar.TopBarWindow.Window.Purchases:GetChildren()
function Disable_Buttons()
for i,v in pairs(__Buttons_:GetChildren()) do
if v:IsA("TextButton") then
if v.Window_Button.Value == true then
Tween_Service__:Create(v, Tween_Info, {BackgroundTransparency = 1}):Play()
Tween_Service__:Create(v.Icon, Tween_Info, {ImageTransparency = 1}):Play()
Tween_Service__:Create(v.DropShadow, Tween_Info, {ImageTransparency = 1}):Play()
Tween_Service__:Create(v.Tip, Tween_Info, {TextTransparency = 1}):Play()
Tween_Service__:Create(v.Tip, Tween_Info, {BackgroundTransparency = 1}):Play()
wait(.2)
v.Hover_Image.ImageTransparency = 1
v.Visible = false
end
end
end
end
Remotes__.DisableButtons.Event:Connect(Disable_Buttons)
function Enable_Buttons()
for i,v in pairs(__Buttons_:GetChildren()) do
if v:IsA("TextButton") then
if v.Window_Button.Value == true then
v.Visible = true
Tween_Service__:Create(v, Tween_Info, {BackgroundTransparency = 0}):Play()
Tween_Service__:Create(v.Icon, Tween_Info, {ImageTransparency = 0}):Play()
Tween_Service__:Create(v.DropShadow, Tween_Info, {ImageTransparency = 0.85}):Play()
Tween_Service__:Create(v.Tip, Tween_Info, {TextTransparency = 0}):Play()
Tween_Service__:Create(v.Tip, Tween_Info, {BackgroundTransparency = 0}):Play()
end
end
end
end
Remotes__.EnableButtons.Event:Connect(Enable_Buttons)
function Open_TopBarMenu()
if TopBarMenu_Opened == false then
TopBarMenu_Opened = true
for i,v in pairs(Purchases) do
if v:IsA("TextButton") then
Remotes__.DisableButtons:Fire()
wait(0.5)
TopBarWindow.Visible = true
Tween_Service__:Create(v, Tween_Info, {BackgroundTransparency = 0}):Play()
Tween_Service__:Create(TopBarWindow, Tween_Info, {BackgroundTransparency = 0}):Play()
Tween_Service__:Create(v.text1, Tween_Info, {TextTransparency = 0}):Play()
Tween_Service__:Create(v.text2, Tween_Info, {TextTransparency = 0}):Play()
Tween_Service__:Create(v.Icon, Tween_Info, {ImageTransparency = 0.8}):Play()
Tween_Service__:Create(TopBarWindow.Window.Close, Tween_Info, {TextTransparency = 0}):Play()
TopBarWindow:TweenPosition(UDim2.new(0.499, 0,3.02, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.4)
end
end
end
end
__Buttons_.Shop.MouseButton1Down:Connect(Open_TopBarMenu)
function Close_TopBarMenu()
for i,v in pairs(Purchases) do
if v:IsA("TextButton") then
if TopBarMenu_Opened == true then
TopBarMenu_Opened = false
Tween_Service__:Create(v, Tween_Info, {BackgroundTransparency = 1}):Play()
Tween_Service__:Create(TopBarWindow, Tween_Info, {BackgroundTransparency = 1}):Play()
Tween_Service__:Create(v.text1, Tween_Info, {TextTransparency = 1}):Play()
Tween_Service__:Create(v.text2, Tween_Info, {TextTransparency = 1}):Play()
Tween_Service__:Create(v.Icon, Tween_Info, {ImageTransparency = 1}):Play()
Tween_Service__:Create(TopBarWindow.Window.Close, Tween_Info, {TextTransparency = 1}):Play()
TopBarWindow:TweenPosition(UDim2.new(0.919, 0,3.02, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.4)
wait(0.4)
Remotes__.EnableButtons:Fire()
TopBarWindow.Visible = false
TopBarWindow.Position = UDim2.new(0.119, 0,3.02, 0)
end
end
end
end
TopBarWindow.Window.Close.MouseButton1Down:Connect(Close_TopBarMenu)
Really would appreciate some help asap.