For some reason this script doesn’t work on its own unless another gui is closed first.
So if I open this gui first and try to close it, it doesn’t detect the player clicking the exit button
but if I open another gui and close it before trying to close this one it will finally work perfectly fine as if nothing was wrong.
Me and my friends revised this hundreds of times and still cannot figure out what the issue is. We see no issues…
all my other scripts have basically the same closing script and they all work fine… its just this one causing issues.
SCRIPT:
local ExitButton = script.Parent
local OpenedInventory = script.Parent.Parent
local Titles = OpenedInventory.TitlesButton
local Bakcground = OpenedInventory.InventoryBackground
local HatsFrame = OpenedInventory.HatsFrame
local TitlesFrame = OpenedInventory.TitlesFrame
local PetsFrame = OpenedInventory.PetsFrame
local ColorsFrame = OpenedInventory.ColorsFrame
local Open = OpenedInventory.OpenClose
local Tweening = game:GetService("TweenService")
function leftClick()
if Open.Value == true then
Open.Value = false
local Tween = Tweening:Create(Bakcground, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 1}):Play()
local Tween = Tweening:Create(Titles, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 1}):Play()
local Tween = Tweening:Create(Titles, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextTransparency = 1}):Play()
local Tween = Tweening:Create(ExitButton, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {ImageTransparency = 1}):Play()
local Tween = Tweening:Create(HatsFrame, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Visible = false}):Play()
local Tween = Tweening:Create(TitlesFrame, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Visible = false}):Play()
local Tween = Tweening:Create(PetsFrame, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Visible = false}):Play()
local Tween = Tweening:Create(ColorsFrame, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Visible = false}):Play()
wait(1)
OpenedInventory.Visible = false
end
end
script.Parent.MouseButton1Click:Connect(leftClick)
Here is a video showing me trying to click close and it not working but then magically fixing itself after I open anything else.