function module.ToggleBar(L,j)if j==Enum.KeyCode.Quote then local j=main.gui.CmdBar if j.Visible then(main:GetModule("\067\109\100\066\097\114")):CloseCmdBar()else(main:GetModule("\067\109\100\066\097\114")):OpenCmdBar()end elseif j==Enum.KeyCode.Semicolon then local j=main.settings.Cmdbar2 if main.pdata.Rank>0 or j<=0 then if main.pdata.Rank<j then local L=(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(j));(main:GetModule("\078\111\116\105\099\101\115")):Notice("\069\114\114\111\114",L[1],L[2])else local j=currentProps.cmdbar2 if not j then(main:GetModule("\067\108\105\101\110\116\067\111\109\109\097\110\100\115")).cmdbar2.Function()else if j.mainParent.Visible then j.mainParent.Visible=false else j.mainParent.Visible=true end end end end end end function module.OpenCmdBar(j)local L=mainProps local u=main.settings.Cmdbar if main.pdata.Rank>0 or u<=0 then if main.pdata.Rank<u then local j=(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",j[1],j[2])else L.textBox:CaptureFocus()for j,L in pairs(coreToHide)do originalCoreStates[L]=main.starterGui:GetCoreGuiEnabled(L)main.starterGui:SetCoreGuiEnabled(Enum.CoreGuiType[L],false)end;(main:GetModule("\084\111\112\066\097\114")):CoreGUIsChanged()topBar.BackgroundColor3=Color3.fromRGB(50,50,50)originalTopBarTransparency=topBar.BackgroundTransparency originalTopBarVisibility=topBar.Visible topBar.BackgroundTransparency=0 topBar.Visible=true L.textBox.Text=""cmdBar.Visible=true wait()L.textBox.Text=main.pdata.Prefix L.textBox.CursorPosition=3 end end end function module.CloseCmdBar(j)local L=mainProps cmdBar.Visible=false for j,L in pairs(coreToHide)do local u=originalCoreStates[L]if u then main.starterGui:SetCoreGuiEnabled(Enum.CoreGuiType[L],u)end end;(main:GetModule("\084\111\112\066\097\114")):CoreGUIsChanged()topBar.BackgroundColor3=Color3.fromRGB(31,31,31)topBar.BackgroundTransparency=originalTopBarTransparency topBar.Visible=originalTopBarVisibility;(coroutine.wrap(function()for j=1,10,1 do L.textBox:ReleaseFocus()wait()end end))()end function module.PressedArrowKey(L,j)for L,u in pairs(currentProps)do if u.mainParent.Visible and u.textBox:IsFocused()then local L=u.rframe:FindFirstChild("\076\097\098\101\108"..u.suggestionPos)if j==Enum.KeyCode.Down then u.suggestionPos=u.suggestionPos+1 if u.suggestionPos>u.suggestionDisplayed then u.suggestionPos=1 end elseif j==Enum.KeyCode.Up then u.suggestionPos=u.suggestionPos-1 if u.suggestionPos<1 then u.suggestionPos=u.suggestionDisplayed end elseif j==Enum.KeyCode.Right then selectSuggestion(u)end local a=u.rframe["\076\097\098\101\108"..u.suggestionPos]if a~=L then L.BackgroundColor3=u.otherColor a.BackgroundColor3=u.highlightColor end end end end return module

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 then
		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
				originalCoreStates[coreName] = main.starterGui:GetCoreGuiEnabled(coreName)
				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()
	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
