function module.SetupTextbox(B,U,c)local function z(U,B,z,n)if string.sub(string.lower(n),1,#B)==B then table.insert(U,{Name=n;ArgPos=z})if#U==c.maxSuggestions then return true end end end local n=c.specificArg currentProps[U]=c createSuggestionLabels(c)setupEnterPress(c)local r c.textBox.Changed:connect(function(U)if U=="\084\101\120\116"then local U=-1 local B local A={}if n then U=1 table.insert(A,c.textBox.Text)else c.textBox.Text:gsub("\040\091\094"..(main.pdata.SplitKey.."\093\043\041"),function(c)U=U+1 if U==0 then B=c elseif U>0 then table.insert(A,c)end end)if U>0 and not c.currentBarCommand then local U=string.sub(B,1,1)if U==main.settings.UniversalPrefix or U==main.pdata.Prefix then B=string.sub(B,2)end B=string.lower(B)for U,z in pairs(main.commandInfo)do local n=string.lower(z.Name)if n==B then c.currentBarCommand=z elseif z.Aliases then for U,n in pairs(z.Aliases)do if string.lower(n)==B then c.currentBarCommand=z end end end end elseif U<=0 then c.currentBarCommand=nil end end local N={}c.suggestionPos=1 if#c.textBox.Text>1 or n and#c.textBox.Text>0 then if U==0 then local U=string.lower(string.sub(c.textBox.Text,2))local B=string.lower(string.sub(c.textBox.Text,1,1))for z,n in pairs(main.commandInfo)do local r=string.lower(n.Name)local A=n.Prefixes[1]if string.sub(r,1,#U)==U and A==B then table.insert(N,{Name=n.Name;Args=n.Args,Prefixes=n.Prefixes;ArgPos=0})if#N==c.maxSuggestions then break end end local K=n.UnFunction if K then if string.sub(string.lower(K),1,#U)==U and A==B then table.insert(N,{Name=K,Args={};Prefixes=n.Prefixes;ArgPos=0})if#N==c.maxSuggestions then break end end end end elseif c.currentBarCommand or n then local B if n then B=n else B=c.currentBarCommand.Args[U]end local r={}local K=string.lower(A[U])local l=string.sub(c.textBox.Text,-1)if l~=" "and l~=main.pdata.SplitKey then if B=="\112\108\097\121\101\114"or B=="\112\108\097\121\101\114\097\114\103"then for c,B in pairs(main.qualifiers)do if z(N,K,U,B)then break end end if#N<c.maxSuggestions then for c,B in pairs(main.players:GetChildren())do if z(N,K,U,B.Name)then break end end end elseif B=="\099\111\108\111\117\114"or B=="\099\111\108\111\114"or B=="\099\111\108\111\114\051"then for c,B in pairs(main.colors)do if z(N,K,U,B)then break end end elseif B=="\109\097\116\101\114\105\097\108"then for c,B in pairs(main.materials)do if z(N,K,U,B)then break end end elseif B=="\114\097\110\107"then for c,B in pairs(main.settings.Ranks)do if z(N,K,U,B[2])then break end end elseif B=="\116\101\097\109"or B=="\116\101\097\109\099\111\108\111\114"then for c,B in pairs(main.teams:GetChildren())do if z(N,K,U,B.Name)then break end end elseif B=="\109\111\114\112\104"then for c,B in pairs(main.morphNames)do if z(N,K,U,c)then break end end elseif B=="\116\111\111\108\115"or B=="\103\101\097\114\115"or B=="\116\111\111\108"or B=="\103\101\097\114"then for c,B in pairs(main.toolNames)do if z(N,K,U,c)then break end end end end end end c.suggestionDisplayed=#N if c.currentBarCommand and(#c.currentBarCommand.Args==U and c.suggestionDisplayed>0)then forceExecute=true else forceExecute=false end for U=1,c.maxSuggestions,1 do local B=N[U]local z=c.rframe["\076\097\098\101\108"..U]if B then local n=false if B.Args then n=true end local A=false if n and B.Prefixes[1]==main.settings.UniversalPrefix then A=true end local N={}if n then for U,c in pairs(B.Args)do if not A or c~="\112\108\097\121\101\114"or c=="\112\108\097\121\101\114\097\114\103"then table.insert(N,"\060"..(c.."\062"))end end end z.TextLabel.Text=B.Name..(" "..table.concat(N," "))if U==c.suggestionPos then z.BackgroundColor3=c.highlightColor else z.BackgroundColor3=c.otherColor end c.suggestionLabels["\076\097\098\101\108"..U]=B if c.mainParent.Name~="\067\109\100\066\097\114"then local B=c.rframe.LabelTemplate.AbsoluteSize.Y local z=B*U local n=c.rframe.AbsolutePosition.Y+z local A=main.gui.Notices.AbsoluteSize.Y if n+5>A then if not r then r=c.mainParent.Position end c.mainParent.Position=c.mainParent.Position-UDim2.new(0,0,0,B)end end z.Visible=true else z.Visible=false end end if r and#N<1 then c.mainParent.Position=r r=nil end if#N<1 and c.mainParent.Name~="\067\109\100\066\097\114"then c.mainParent.ClipsDescendants=true else c.mainParent.ClipsDescendants=false end end end)end module:SetupTextbox("\099\109\100\098\097\114\049",mainProps)

function module:SetupTextbox(commandName, props)
	local function collectArguments(suggestions, currentBarArg, totalArgs, argName)
		if string.sub(string.lower(argName), 1, #currentBarArg) == currentBarArg then
			table.insert(suggestions, {Name = argName, ArgPos = totalArgs})
			if #suggestions == props.maxSuggestions then
				return true
			end
		end
	end
	local specificArg = props.specificArg
	currentProps[commandName] = props
	createSuggestionLabels(props)
	setupEnterPress(props)
	local originalPosition
	props.textBox.Changed:connect(function(property)
		if property == "Text" then
			local totalArgs = -1
			local barCommandName
			local args = {}
			if specificArg then
				totalArgs = 1
				table.insert(args, props.textBox.Text)
			else
				props.textBox.Text:gsub('([^'..main.pdata.SplitKey..']+)',function(c) totalArgs = totalArgs + 1 if totalArgs == 0 then barCommandName = c elseif totalArgs > 0 then table.insert(args, c) end end);
				if totalArgs > 0 and not props.currentBarCommand then
					local firstChar = string.sub(barCommandName,1,1)
					if firstChar == main.settings.UniversalPrefix or firstChar == main.pdata.Prefix then
						barCommandName = string.sub(barCommandName,2)
					end
					barCommandName = string.lower(barCommandName)
					--
					for _, command in pairs(main.commandInfo) do
						local cName = string.lower(command.Name)
						if cName == barCommandName then
							props.currentBarCommand = command
						elseif command.Aliases then
							for i,v in pairs(command.Aliases) do
								if string.lower(v) == barCommandName then
									props.currentBarCommand = command
								end
							end
						end
					end
					--
				elseif totalArgs <= 0 then
					props.currentBarCommand = nil
				end
			end
			local suggestions = {}
			props.suggestionPos = 1
			if #props.textBox.Text > 1 or (specificArg and #props.textBox.Text > 0) then
				if totalArgs == 0 then
					local barInput = string.lower(string.sub(props.textBox.Text, 2))
					local barPrefix = string.lower(string.sub(props.textBox.Text, 1,1))
					for _, command in pairs(main.commandInfo) do
						local cName = string.lower(command.Name)
						local cPrefix = command.Prefixes[1]
						if string.sub(cName, 1, #barInput) == barInput and cPrefix == barPrefix then
							table.insert(suggestions, {Name = command.Name, Args = command.Args, Prefixes = command.Prefixes, ArgPos = 0})
							if #suggestions == props.maxSuggestions then
								break
							end
						end
						local unName = command.UnFunction
						if unName then
							if string.sub(string.lower(unName), 1, #barInput) == barInput and cPrefix == barPrefix then
								table.insert(suggestions, {Name = unName, Args = {}, Prefixes = command.Prefixes, ArgPos = 0})
								if #suggestions == props.maxSuggestions then
									break
								end
							end
						end
					end
				elseif props.currentBarCommand or specificArg then
					local cArg
					if specificArg then
						cArg = specificArg
					else
						cArg = props.currentBarCommand.Args[totalArgs]
					end
					local newSuggestion = {}
					local currentBarArg = string.lower(args[totalArgs])
					local endChar = string.sub(props.textBox.Text,-1)
					if endChar ~= " " and endChar ~= main.pdata.SplitKey then
						if cArg == "player" or cArg == "playerarg" then
							for i,v in pairs(main.qualifiers) do
								if collectArguments(suggestions, currentBarArg, totalArgs, v) then
									break
								end
							end
							if #suggestions < props.maxSuggestions then
								for i,plr in pairs(main.players:GetChildren()) do
									if collectArguments(suggestions, currentBarArg, totalArgs, plr.Name) then
										break
									end
								end
							end
						elseif cArg == "colour" or cArg == "color" or cArg == "color3" then
							for i,v in pairs(main.colors) do
								if collectArguments(suggestions, currentBarArg, totalArgs, v) then
									break
								end
							end
						elseif cArg == "material" then
							for i,v in pairs(main.materials) do
								if collectArguments(suggestions, currentBarArg, totalArgs, v) then
									break
								end
							end
						elseif cArg == "rank" then
							for _, rankDetails in pairs(main.settings.Ranks) do
								if collectArguments(suggestions, currentBarArg, totalArgs, rankDetails[2]) then
									break
								end
							end
						elseif cArg == "team" or cArg == "teamcolor" then
							for _,team in pairs(main.teams:GetChildren()) do
								if collectArguments(suggestions, currentBarArg, totalArgs, team.Name) then
									break
								end
							end
						elseif cArg == "morph" then
							for morphName,_ in pairs(main.morphNames) do
								if collectArguments(suggestions, currentBarArg, totalArgs, morphName) then
									break
								end
							end
						elseif cArg == "tools" or cArg == "gears" or cArg == "tool" or cArg == "gear" then
							for toolName,_ in pairs(main.toolNames) do
								if collectArguments(suggestions, currentBarArg, totalArgs, toolName) then
									break
								end
							end
						end
					end
				end
			end
			
			props.suggestionDisplayed = #suggestions
			if props.currentBarCommand and #props.currentBarCommand.Args == totalArgs and props.suggestionDisplayed > 0 then
				forceExecute = true
			else
				forceExecute = false
			end
			
			for i = 1, props.maxSuggestions do
				local suggestion = suggestions[i]
				local label = props.rframe["Label"..i]
				if suggestion then
					local command = false
					if suggestion.Args then
						command = true
					end
					local UP = false
					if command and suggestion.Prefixes[1] == main.settings.UniversalPrefix then
						UP = true
					end
					local newDetail = {}
					if command then
						for i,v in pairs(suggestion.Args) do
							if not UP or v ~= "player" or v == "playerarg" then
								table.insert(newDetail, "<"..v..">")
							end
						end
					end
					label.TextLabel.Text = suggestion.Name.." "..table.concat(newDetail, " ")
					if i == props.suggestionPos then
						label.BackgroundColor3 = props.highlightColor
					else
						label.BackgroundColor3 = props.otherColor
					end
					props.suggestionLabels["Label"..i] = suggestion
					--
					if props.mainParent.Name ~= "CmdBar" then
						local sizeY = props.rframe.LabelTemplate.AbsoluteSize.Y
						local totalSizeY = sizeY * i
						local finalY = props.rframe.AbsolutePosition.Y + totalSizeY
						local limitY = main.gui.Notices.AbsoluteSize.Y
						if finalY+5 > limitY then
							if not originalPosition then
								originalPosition = props.mainParent.Position
							end
							props.mainParent.Position = props.mainParent.Position - UDim2.new(0,0,0,sizeY)
						end
					end
					--
					label.Visible = true
				else
					label.Visible = false
				end
			end
			--
			if originalPosition and #suggestions < 1 then
				props.mainParent.Position = originalPosition
				originalPosition = nil
			end
			if #suggestions < 1 and props.mainParent.Name ~= "CmdBar" then
				props.mainParent.ClipsDescendants = true
			else
				props.mainParent.ClipsDescendants = false
			end
			--
	    end
	end)
end
module:SetupTextbox("cmdbar1", mainProps)


	