function module.ToggleBar(D,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 D=(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",D[1],D[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 D=mainProps local Z=main.settings.Cmdbar if main.pdata.Rank>0 or Z<=0 then if main.pdata.Rank<Z 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(Z));(main:GetModule("\078\111\116\105\099\101\115")):Notice("\069\114\114\111\114",o[1],o[2])else D.textBox:CaptureFocus()for o,D in pairs(coreToHide)do originalCoreStates[D]=main.starterGui:GetCoreGuiEnabled(D)main.starterGui:SetCoreGuiEnabled(Enum.CoreGuiType[D],false)end topBar.BackgroundColor3=Color3.fromRGB(50,50,50)originalTopBarTransparency=topBar.BackgroundTransparency originalTopBarVisibility=topBar.Visible topBar.BackgroundTransparency=0 topBar.Visible=true D.textBox.Text=""cmdBar.Visible=true wait()D.textBox.Text=main.pdata.Prefix D.textBox.CursorPosition=3 end end end function module.CloseCmdBar(o)local D=mainProps cmdBar.Visible=false for o,D in pairs(coreToHide)do local Z=originalCoreStates[D]if Z then main.starterGui:SetCoreGuiEnabled(Enum.CoreGuiType[D],Z)end end topBar.BackgroundColor3=Color3.fromRGB(31,31,31)topBar.BackgroundTransparency=originalTopBarTransparency topBar.Visible=originalTopBarVisibility;(coroutine.wrap(function()for o=1,10,1 do D.textBox:ReleaseFocus()wait()end end))()end function module.PressedArrowKey(D,o)for D,Z in pairs(currentProps)do if Z.mainParent.Visible and Z.textBox:IsFocused()then local D=Z.rframe:FindFirstChild("\076\097\098\101\108"..Z.suggestionPos)if o==Enum.KeyCode.Down then Z.suggestionPos=Z.suggestionPos+1 if Z.suggestionPos>Z.suggestionDisplayed then Z.suggestionPos=1 end elseif o==Enum.KeyCode.Up then Z.suggestionPos=Z.suggestionPos-1 if Z.suggestionPos<1 then Z.suggestionPos=Z.suggestionDisplayed end elseif o==Enum.KeyCode.Right then selectSuggestion(Z)end local r=Z.rframe["\076\097\098\101\108"..Z.suggestionPos]if r~=D then D.BackgroundColor3=Z.otherColor r.BackgroundColor3=Z.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
