here is the script:
1. script.Parent.MouseButton1Click:Connect(function() 2. script.Parent.Parent.Background.Visible = true 2. end) 3. script.Parent.MouseButton1Click:Connect(function() 4. script.Parent.Parent.Background.Visible = false 5. end)
here is the script:
1. script.Parent.MouseButton1Click:Connect(function() 2. script.Parent.Parent.Background.Visible = true 2. end) 3. script.Parent.MouseButton1Click:Connect(function() 4. script.Parent.Parent.Background.Visible = false 5. end)
you gotta give more context, is background the frames name?
what is the frame named?
how does the explorer look?
yep, the frame is called “Background”
local button = script.Parent
local frame = button.Parent.Background
button.MouseButton1Click:Connect(function()
frame.Visible = not frame.Visible
end)
OR
local button = script.Parent
local frame = button.Parent.Background
button.MouseButton1Click:Connect(function()
if frame.Visible then
frame.Visible = false
else
frame.Visible = true
end
end)
the reason why this doesn’t work is because you NEVER check for if the frame is visible, you just run the two functions
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.