function module.ToggleBar(m,o)if o==Enum.KeyCode.Quote then local o=main.gui.CmdBar if o.Visible then(main:GetModule("\067\109\100\066\097\114")):CloseCmdBar()else(main:GetModule("\067\109\100\066\097\114")):OpenCmdBar()end elseif o==Enum.KeyCode.Semicolon then local o=main.settings.Cmdbar2 if main.pdata.Rank>0 or o<=0 then if main.pdata.Rank<o then local m=(main:GetModule("\099\102")):FormatNotice("\067\111\109\109\097\110\100\066\097\114\076\111\099\107\101\100","\050",(main:GetModule("\099\102")):GetRankName(o));(main:GetModule("\078\111\116\105\099\101\115")):Notice("\069\114\114\111\114",m[1],m[2])else local o=currentProps.cmdbar2 if not o then(main:GetModule("\067\108\105\101\110\116\067\111\109\109\097\110\100\115")).cmdbar2.Function()else if o.mainParent.Visible then o.mainParent.Visible=false else o.mainParent.Visible=true end end end end end end function module.OpenCmdBar(o)local m=mainProps local U=main.settings.Cmdbar if(main.pdata.Rank>0 or U<=0)and not isOpen then isOpen=true if main.pdata.Rank<U then local o=(main:GetModule("\099\102")):FormatNotice("\067\111\109\109\097\110\100\066\097\114\076\111\099\107\101\100","",(main:GetModule("\099\102")):GetRankName(U));(main:GetModule("\078\111\116\105\099\101\115")):Notice("\069\114\114\111\114",o[1],o[2])else m.textBox:CaptureFocus()for o,m in pairs(coreToHide)do local U=main.starterGui:GetCoreGuiEnabled(m)originalCoreStates[m]=U main.starterGui:SetCoreGuiEnabled(Enum.CoreGuiType[m],false)end topBar.BackgroundColor3=Color3.fromRGB(50,50,50)originalTopBarTransparency=topBar.BackgroundTransparency originalTopBarVisibility=topBar.Visible topBar.BackgroundTransparency=0 topBar.Visible=true m.textBox.Text=""cmdBar.Visible=true wait()m.textBox.Text=main.pdata.Prefix m.textBox.CursorPosition=3 end end end function module.CloseCmdBar(o)if not isOpen then return end isOpen=false local m=mainProps cmdBar.Visible=false for o,m in pairs(coreToHide)do local U=originalCoreStates[m]if U then main.starterGui:SetCoreGuiEnabled(Enum.CoreGuiType[m],U)end end topBar.BackgroundColor3=Color3.fromRGB(31,31,31)topBar.BackgroundTransparency=originalTopBarTransparency topBar.Visible=originalTopBarVisibility;(coroutine.wrap(function()for o=1,10,1 do m.textBox:ReleaseFocus()wait()end end))()end function module.PressedArrowKey(m,o)for m,U in pairs(currentProps)do if U.mainParent.Visible and U.textBox:IsFocused()then local m=U.rframe:FindFirstChild("\076\097\098\101\108"..U.suggestionPos)if o==Enum.KeyCode.Down then U.suggestionPos=U.suggestionPos+1 if U.suggestionPos>U.suggestionDisplayed then U.suggestionPos=1 end elseif o==Enum.KeyCode.Up then U.suggestionPos=U.suggestionPos-1 if U.suggestionPos<1 then U.suggestionPos=U.suggestionDisplayed end elseif o==Enum.KeyCode.Right then selectSuggestion(U)end local y=U.rframe["\076\097\098\101\108"..U.suggestionPos]if y~=m then m.BackgroundColor3=U.otherColor y.BackgroundColor3=U.highlightColor end end end end return module
-- << FUNCTIONS >>
function module:ToggleBar(keyCode)
	if keyCode == Enum.KeyCode.Quote then
		local cmdBar = main.gui.CmdBar
		if cmdBar.Visible then
			main:GetModule("CmdBar"):CloseCmdBar()
		else
			main:GetModule("CmdBar"):OpenCmdBar()
		end
	elseif keyCode == Enum.KeyCode.Semicolon then
		local requiredRank = main.settings.Cmdbar2
		if main.pdata.Rank > 0 or requiredRank <= 0 then
			if main.pdata.Rank < requiredRank then
				local notice = main:GetModule("cf")
					:FormatNotice("CommandBarLocked", "2", main:GetModule("cf"):GetRankName(requiredRank))
				main:GetModule("Notices"):Notice("Error", notice[1], notice[2])
			else
				local props = currentProps["cmdbar2"]
				if not props then
					main:GetModule("ClientCommands")["cmdbar2"].Function()
				else
					if props.mainParent.Visible then
						props.mainParent.Visible = false
					else
						props.mainParent.Visible = true
					end
				end
			end
		end
	end
end

function module:OpenCmdBar()
	local props = mainProps
	local requiredRank = main.settings.Cmdbar
	if (main.pdata.Rank > 0 or requiredRank <= 0) and not isOpen then
		isOpen = true
		if main.pdata.Rank < requiredRank then
			local notice = main:GetModule("cf")
				:FormatNotice("CommandBarLocked", "", main:GetModule("cf"):GetRankName(requiredRank))
			main:GetModule("Notices"):Notice("Error", notice[1], notice[2])
		else
			props.textBox:CaptureFocus()
			for _, coreName in pairs(coreToHide) do
				local originalState = main.starterGui:GetCoreGuiEnabled(coreName)
				originalCoreStates[coreName] = originalState
				main.starterGui:SetCoreGuiEnabled(Enum.CoreGuiType[coreName], false)
			end
			--main:GetModule("TopBar"):CoreGUIsChanged()
			topBar.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
			originalTopBarTransparency = topBar.BackgroundTransparency
			originalTopBarVisibility = topBar.Visible
			topBar.BackgroundTransparency = 0
			topBar.Visible = true
			props.textBox.Text = ""
			cmdBar.Visible = true
			wait()
			props.textBox.Text = main.pdata.Prefix
			props.textBox.CursorPosition = 3
		end
	end
end

function module:CloseCmdBar()
	if not isOpen then
		return
	end
	isOpen = false
	local props = mainProps
	cmdBar.Visible = false
	for _, coreName in pairs(coreToHide) do
		local originalState = originalCoreStates[coreName]
		if originalState then
			main.starterGui:SetCoreGuiEnabled(Enum.CoreGuiType[coreName], originalState)
		end
	end
	--main:GetModule("TopBar"):CoreGUIsChanged()
	topBar.BackgroundColor3 = Color3.fromRGB(31, 31, 31)
	topBar.BackgroundTransparency = originalTopBarTransparency
	topBar.Visible = originalTopBarVisibility
	coroutine.wrap(function()
		for i = 1, 10 do
			props.textBox:ReleaseFocus()
			wait()
		end
	end)()
end

function module:PressedArrowKey(key)
	for i, props in pairs(currentProps) do
		if props.mainParent.Visible and props.textBox:IsFocused() then
			local originalLabel = props.rframe:FindFirstChild("Label" .. props.suggestionPos)
			if key == Enum.KeyCode.Down then
				props.suggestionPos = props.suggestionPos + 1
				if props.suggestionPos > props.suggestionDisplayed then
					props.suggestionPos = 1
				end
			elseif key == Enum.KeyCode.Up then
				props.suggestionPos = props.suggestionPos - 1
				if props.suggestionPos < 1 then
					props.suggestionPos = props.suggestionDisplayed
				end
			elseif key == Enum.KeyCode.Right then
				selectSuggestion(props)
			end
			local newLabel = props.rframe["Label" .. props.suggestionPos]
			if newLabel ~= originalLabel then
				originalLabel.BackgroundColor3 = props.otherColor
				newLabel.BackgroundColor3 = props.highlightColor
			end
		end
	end
end

return module
