Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make the frame not visible after making it visible?

Asked by 8 years ago

This is a GUI button script that's supposed to make the frame FRAME visible when clicked and not visible when clicked again, and leaving "Scrollingframe" visible the whole time. It also is supposed to make all of the other frames that aren't FRAME not visible when clicked. The problem now is that everything works like its supposed to except when i click the button it doesn't make FRAME not visible. The way I was doing it before was the FRAME.Visible = (not FRAME.Visible) line but that doesn't seem to be working anymore. How can i tell the script to make FRAME not visible again when i click it a second time?

local BUTTON = script.Parent
local ITFRAME = BUTTON.Parent.Parent
local FRAME = ITFRAME.SmallHandle 
local NAME = BUTTON.Text
local ITEMNAME = FRAME.Itemname
local ScrollingFrame = ITFRAME.ScrollingFrame

FRAME.Visible = false

function on_button1_down()
   for I,v in pairs (ITFRAME:GetChildren()) do
if v.Name == "ScrollingFrame"
--or v.Name == "Hull"  -- not sure if I should put this in here or not
then v.Visible = true
else v.Visible = false
    FRAME.Visible = (not FRAME.Visible)
        end
    end
    ITEMNAME.Text = NAME
end
BUTTON.MouseButton1Down:connect(on_button1_down)

0
You've got some funny loop logic going on there. If the child is not called ScrollingFrame then the FRAME will toggle visibility. If v is FRAME, then it will become visible regardless. User#6546 35 — 8y
0
so how do i make the FRAME toggle visibility if v is FRAME instead of being visible regardless? Gwolflover 80 — 8y

Answer this question