#Codes/Gui Problem

4 messages · Page 1 of 1 (latest)

opal onyx
#
local Frame = script.Parent
local ActualFrameVisible = {}
isTweening = false

local function OpenAndClose(t: Frame, pastSize)
    if isTweening == true then return end
    if #ActualFrameVisible ~= 0 then
        for i, v in ActualFrameVisible do
            if v ~= t then
                print(v)
                table.remove(ActualFrameVisible, table.find(ActualFrameVisible, v))
                v.Visible = false
            end
        end
    end
    if t.Visible == false then
        isTweening = true
        t.Size = UDim2.new(0,0,0,0)
        t.Visible = true
        t:TweenSize(pastSize, Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.1, true)
        task.wait(0.15)
        table.insert(ActualFrameVisible, t)
        isTweening = false    
    else
        isTweening = true
        t:TweenSize(UDim2.new(0,0,0,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.1, true)
        task.wait(0.15)
        t.Visible = false
        t.Size = pastSize
        isTweening = false
    end
    
end

local function Open(btn, haveFrame)
    local closeButton
    local target
    if haveFrame == true then
        target = Frame.Parent:FindFirstChild(btn.Parent.Name.."Menu")
        closeButton = target:FindFirstChild(btn.Parent.Name.."Close")
    end

    local btnProportions = {}

    btnProportions.xScale = btn.Parent.Size.X.Scale+0.005
    btnProportions.yScale = btn.Parent.Size.Y.Scale+0.005

    btnProportions.X = btn.Parent.Size.X.Scale
    btnProportions.Y = btn.Parent.Size.Y.Scale

    btn.Parent.MouseEnter:Connect(function()
        task.wait(0.03)
        btn.Parent:TweenSize(UDim2.new(btnProportions.xScale, 0, btnProportions.yScale, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.03, true)
    end)

    btn.Parent.MouseLeave:Connect(function()
        task.wait(0.03)
        btn.Parent:TweenSize(UDim2.new(btnProportions.X, 0, btnProportions.Y, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.03, true)
    end)
    
    btn.MouseButton1Down:Connect(function()
        task.wait(0.03)
        btn.Parent:TweenSize(UDim2.new(btnProportions.xScale-0.005, 0, btnProportions.yScale-0.005, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.03, true)
        if isTweening == true then return end
        if not target then return end
        OpenAndClose(target, target.Size)    
    end)
    
    btn.MouseButton1Up:Connect(function()
        task.wait(0.03)
        btn.Parent:TweenSize(UDim2.new(btnProportions.xScale, 0, btnProportions.yScale, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.03, true)
    end)
    
    if closeButton then
        closeButton.MouseButton1Down:Connect(function()
            OpenAndClose(target, target.Size)
        end)
    end
end

Open(Frame.Codes.CodeButton, true)

Open/Close does not work while I added right points and frame.

#

nvm fixed

#

myself