the elseif doesn’t work as intended, anyone know why?
i want it to close the gui after clicked while the gui is open
local Clickable = true
Preview = script.Parent.Parent:WaitForChild("Preview")
for i, Frame in pairs(script.Parent:GetChildren()) do
if Frame:IsA("Frame") then
Frame:WaitForChild("Button").MouseButton1Click:connect(function()
if Frame.Name == "Settings" and Clickable == true and script.Parent.Parent.Parent.Menus.Settings.Visible == false then
Clickable = false
local Settings = script.Parent.Parent.Parent.Menus:WaitForChild("Settings")
Settings.Position = UDim2.new(0.5, 0,0.65, 0)
Settings.Exit.Transparency = 1
Settings.Visible = true
Settings:TweenPosition(UDim2.new(0.5, 0,0.5, 0))
for i, Frame in pairs(Settings.Main.ScrollingFrame:GetChildren()) do
if Frame:IsA("Frame") then
Frame.Visible = true
Frame.Size = UDim2.new(0.609, -10,-0.023, 50)
Frame:TweenSize(UDim2.new(1, -10,0.023, 50))
wait(0.075)
end
end
repeat
wait(0.01)
game.Lighting.Blur.Size = game.Lighting.Blur.Size+1
until game.Lighting.Blur.Size == 10
repeat
wait()
Settings.Exit.Transparency = Settings.Exit.Transparency-0.05
until Settings.Exit.Transparency == 0
Clickable = true
elseif Frame.Name == "Settings" and Clickable == true then
Clickable = false
local Settings = script.Parent.Parent.Parent.Menus:WaitForChild("Settings")
Settings.Visible = false
Settings.Exit.Transparency = 0
repeat
wait(0.01)
game.Lighting.Blur.Size = game.Lighting.Blur.Size-1
until game.Lighting.Blur.Size == 0
for i, Frame in pairs(Settings.Main.ScrollingFrame:GetChildren()) do
if Frame:IsA("Frame") then
Frame.Visible = false
Clickable = true
end
end
end
end)
end
end