Explanation
My goal is to simply have the frame open when I hit the keybind which is determined by a Value already set.
Issue
My issue is that my AlternativeCloseTabs() function runs approximately 24 times without being in a loop.

Solutions
I’ve tried the following;
- Reprogramming everything from scratch x2;
- Removing variables;
- Adding & removing certain
ifstatements;
Script Info
This is all in a local script.
Issue Code
local function AlternativeCloseTabs(Name)
for _,GUI in pairs (script.Parent.Parent.Parent.GUIs:GetChildren()) do
for c,SFrame in pairs (script.Parent.GUIScrollingFrame:GetChildren()) do
for x,Button in pairs (SFrame:GetChildren()) do
if GUI.Name ~= Name then
GUI.Visible = false
end
if Button.Indicator.BackgroundColor3 ~= Color3.fromRGB(0,0,0) then
Button.Indicator.BackgroundColor3 = Color3.fromRGB(170,0,0)
end
if Button.Text ~= Button.LabelName.Value then
Button.Text = Button.LabelName.Value..": Closed"
end
print("ClosedTabs")
end
end
end
end
Full Code
--//Made By MillerrIAm\\--
--/Variables\--
local UIS = game:GetService("UserInputService")
local Tween = false
--/Functions\--
local function TweenCloseTabs(Name)
for _,GUI in pairs (script.Parent.Parent.Parent.GUIs:GetChildren()) do
for c,SFrame in pairs (script.Parent.GUIScrollingFrame:GetChildren()) do
for x,Button in pairs (SFrame:GetChildren()) do
if GUI.Name ~= Name then
GUI:TweenPosition(UDim2.new(-1, 0, GUI.Position.Y.Scale, 0), 'In', 'Linear', 0.3)
end
if Button.Indicator.BackgroundColor3 ~= Color3.fromRGB(0,0,0) then
Button.Indicator.BackgroundColor3 = Color3.fromRGB(170,0,0)
end
if Button.Text ~= Button.LabelName.Value then
Button.Text = Button.LabelName.Value..": Closed"
end
end
end
end
end
local function TweenTabControl(GUIName)
local Panel = script.Parent.Parent.Parent["Settings Frame"]
local GUIs = script.Parent.Parent.Parent.GUIs
for c,Frame in pairs (script.Parent.GUIScrollingFrame:GetChildren()) do
for _,Button in pairs (Frame:GetChildren()) do
if Panel.Position == UDim2.new(0.001, 0, Panel.Position.Y.Scale, 0) then
if GUIs[GUIName].Position == UDim2.new(-1, 0, GUIs[GUIName].Position.Y.Scale, 0) then
GUIs[GUIName]:TweenPosition(UDim2.new(0.1, 0, GUIs[GUIName].Position.Y.Scale, 0), 'In', 'Linear', 0.3)
if Frame.Name == GUIName.." Frame" then
Button.Indicator.BackgroundColor3 = Color3.fromRGB(0,170,0)
Button.Text = Button.LabelName.Value..": Open"
end
else
GUIs[GUIName]:TweenPosition(UDim2.new(-1, 0, GUIs[GUIName].Position.Y.Scale, 0), 'In', 'Linear', 0.3)
if Frame.Name == GUIName.." Frame" then
Button.Indicator.BackgroundColor3 = Color3.fromRGB(170,0,0)
Button.Text = Button.LabelName.Value..": Closed"
end
end
end
end
end
end
local function AlternativeCloseTabs(Name)
for _,GUI in pairs (script.Parent.Parent.Parent.GUIs:GetChildren()) do
for c,SFrame in pairs (script.Parent.GUIScrollingFrame:GetChildren()) do
for x,Button in pairs (SFrame:GetChildren()) do
if GUI.Visible == true then
GUI.Visible = false
end
if Button.Indicator.BackgroundColor3 ~= Color3.fromRGB(0,0,0) then
Button.Indicator.BackgroundColor3 = Color3.fromRGB(170,0,0)
end
if Button.Text ~= Button.LabelName.Value then
Button.Text = Button.LabelName.Value..": Closed"
end
end
end
end
end
local function AlternativeTabControl(GUIName)
local Panel = script.Parent.Parent.Parent["Settings Frame"]
local GUIs = script.Parent.Parent.Parent.GUIs
for c,Frame in pairs (script.Parent.GUIScrollingFrame:GetChildren()) do
for _,Button in pairs (Frame:GetChildren()) do
if Panel.Position == UDim2.new(0.001, 0, Panel.Position.Y.Scale, 0) then
if GUIs[GUIName].Visible == false then
GUIs[GUIName].Visible = true
if Frame.Name == GUIName.." Frame" then
Button.Indicator.BackgroundColor3 = Color3.fromRGB(0,170,0)
Button.Text = Button.LabelName.Value..": Open"
end
elseif GUIs[GUIName].Visible == true then
GUIs[GUIName].Visible = false
if Frame.Name == GUIName.." Frame" then
Button.Indicator.BackgroundColor3 = Color3.fromRGB(170,0,0)
Button.Text = Button.LabelName.Value..": Closed"
end
end
end
end
end
end
local function Check()
local Panel = script.Parent.Parent.Parent["Settings Frame"]
local GUIs = script.Parent.Parent.Parent.GUIs
for _,GUI in pairs (GUIs:GetChildren()) do
if Tween then
GUI.Position = UDim2.new(-1, 0, Panel.Position.Y.Scale, 0)
GUI.Visible = true
else
GUI.Visible = false
GUI.Position = UDim2.new(0.1, 0, Panel.Position.Y.Scale, 0)
end
print("Check Complete")
end
end
--/Main Script\--
Check()
UIS.InputBegan:Connect(function(KeyPressed, gp)
local GUIs = script.Parent.Parent.Parent.GUIs
local Key = Enum.KeyCode
for _,GUI in pairs (GUIs:GetChildren()) do
if KeyPressed.KeyCode == Key[GUI.Keybind.Value] then
if UIS:GetFocusedTextBox() == nil then
if Tween then
TweenCloseTabs(GUI.Name)
TweenTabControl(GUI.Name)
else
AlternativeCloseTabs(GUI.Name)
AlternativeTabControl(GUI.Name)
end
end
end
end
end)
Thank you for any help you can give me.



