koko10233
(Ander507)
1
My script is and i get no errors it has to be a toggle button and it opens but not closes
local settingsF = script.Parent.SettingsF
SettingsB.MouseButton1Click:Connect(function()
local SettingsOpen = false
if SettingsOpen == false then
settingsF.Visible = true
SettingsOpen = true
elseif SettingsOpen == true then
settingsF.Visible = false
SettingsOpen = false
end
end)
cihilli
(panman)
2
Consider placing SettingsOpen outside of the event, otherwise it won’t change from false to true.
local settingsF = script.Parent.SettingsF
local SettingsOpen = false
SettingsB.MouseButton1Click:Connect(function()
if SettingsOpen == false then
settingsF.Visible = true
SettingsOpen = true
elseif SettingsOpen == true then
settingsF.Visible = false
SettingsOpen = false
end
end)
koko10233
(Ander507)
3
worked thanks for the help its fixed now
You can reaaally simplify this code by doing
local settingsF = script.Parent.SettingsF
SettingsB.MouseButton1Click:Connect(function()
settingsF.Visible = not settingsF.Visible
end)
so if it is true, it will set it to not true (false), if false, will set to not false(true)
2 Likes