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