using one script would work and it could be simple
something like this
local TS = game:GetService("TweenService")
local tInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local Main = script.Parent
local Inventory = Main.InventoryFrame
local Open = Main.InventoryButtonFrame.InventoryButton
local Exit = Inventory.ExitButton
-- Try using a global value instead of a BoolValue object
is_tweening = false -- To avoid spamming tweens (spamming open/close)
local function TweenInventory(Open)
if is_tweening then return end -- If the inventory is being closed/opened then ignore
is_tweening = true
local Tween -- Instead of looping you could also use a CanvasGroup and tween the GroupTransparency
for _, Item in Inventory:GetChildren() do
local Properties = {}
local ShowOrHide = Open and 0 or 1
if Item:IsA("ScrollingFrame") then Item.Visible = Open continue end
if Item:IsA("TextButton") then Properties = {["BackgroundTransparency"] = ShowOrHide, ["TextTransparency"] = ShowOrHide} end
if Item:IsA("ImageLabel") then Properties = {["ImageTransparency"] = ShowOrHide} end
Tween = TS:Create(Item, tInfo, Properties)
Tween:Play()
end
Tween.Completed:Connect(function()
Inventory.Visible = false
is_tweening = false
end)
end
local function OpenInventory()
if Inventory.Visible then return end -- If the inventory is already open then ignore the click
TweenInventory(true)
end
local function CloseInventory()
if not Inventory.Visible then return end -- If the inventory is already closed then ignore the click
TweenInventory(false)
end
Exit.MouseButton1Click:Connect(CloseInventory)
Open.MouseButton1Click:Connect(OpenInventory)