local z=game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")local a=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local h=(game:GetService("\080\108\097\121\101\114\115")).LocalPlayer:GetMouse()local n=(game:GetService("\087\111\114\107\115\112\097\099\101")).CurrentCamera local P=script.Parent.Parent local f=require(P.Creator)local M=require(P.Packages.Flipper)local B=f.New local s=P.Components local U={}U.__index=U U.__type="\068\114\111\112\100\111\119\110"function U.New(S,P,U)local F=S.Library local k={Values=U.Values;Value=U.Default;Multi=U.Multi;Buttons={};Opened=false;Type="\068\114\111\112\100\111\119\110";Callback=U.Callback or function() end}local r=(require(s.Element))(U.Title,U.Description,S.Container,false)r.DescLabel.Size=UDim2.new(1,-170,0,14)k.SetTitle=r.SetTitle k.SetDesc=r.SetDesc local i=B("\084\101\120\116\076\097\098\101\108",{FontFace=Font.new("\114\098\120\097\115\115\101\116\058\047\047\102\111\110\116\115\047\102\097\109\105\108\105\101\115\047\071\111\116\104\097\109\083\083\109\046\106\115\111\110",Enum.FontWeight.Regular,Enum.FontStyle.Normal),Text="\086\097\108\117\101";TextColor3=Color3.fromRGB(240,240,240);TextSize=13;TextXAlignment=Enum.TextXAlignment.Left;Size=UDim2.new(1,-30,0,14),Position=UDim2.new(0,8,.5,0),AnchorPoint=Vector2.new(0,.5),BackgroundColor3=Color3.fromRGB(255,255,255);BackgroundTransparency=1;TextTruncate=Enum.TextTruncate.AtEnd;ThemeTag={TextColor3="\084\101\120\116"}})local c=B("\073\109\097\103\101\076\097\098\101\108",{Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\048\055\048\057\055\057\048\057\052\056";Size=UDim2.fromOffset(16,16);AnchorPoint=Vector2.new(1,.5),Position=UDim2.new(1,-8,.5,0),BackgroundTransparency=1;ThemeTag={ImageColor3="\083\117\098\084\101\120\116"}})local u=B("\084\101\120\116\066\117\116\116\111\110",{Size=UDim2.fromOffset(160,30),Position=UDim2.new(1,-10,.5,0);AnchorPoint=Vector2.new(1,.5);BackgroundTransparency=.9;Parent=r.Frame,ThemeTag={BackgroundColor3="\068\114\111\112\100\111\119\110\070\114\097\109\101"}},{B("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,5)}),B("\085\073\083\116\114\111\107\101",{Transparency=.5;ApplyStrokeMode=Enum.ApplyStrokeMode.Border,ThemeTag={Color="\073\110\069\108\101\109\101\110\116\066\111\114\100\101\114"}});c,i})local y=B("\085\073\076\105\115\116\076\097\121\111\117\116",{Padding=UDim.new(0,3)})local j=B("\083\099\114\111\108\108\105\110\103\070\114\097\109\101",{Size=UDim2.new(1,-5,1,-10),Position=UDim2.fromOffset(5,5);BackgroundTransparency=1;BottomImage="\114\098\120\097\115\115\101\116\105\100\058\047\047\054\056\056\057\056\049\050\055\057\049";MidImage="\114\098\120\097\115\115\101\116\105\100\058\047\047\054\056\056\057\056\049\050\055\050\049";TopImage="\114\098\120\097\115\115\101\116\105\100\058\047\047\054\050\055\054\054\052\049\050\050\053";ScrollBarImageColor3=Color3.fromRGB(255,255,255);ScrollBarImageTransparency=.95,ScrollBarThickness=4,BorderSizePixel=0;CanvasSize=UDim2.fromScale(0,0)},{y})local O=B("\070\114\097\109\101",{Size=UDim2.fromScale(1,.6);ThemeTag={BackgroundColor3="\068\114\111\112\100\111\119\110\072\111\108\100\101\114"}},{j,B("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,7)});B("\085\073\083\116\114\111\107\101",{ApplyStrokeMode=Enum.ApplyStrokeMode.Border;ThemeTag={Color="\068\114\111\112\100\111\119\110\066\111\114\100\101\114"}}),B("\073\109\097\103\101\076\097\098\101\108",{BackgroundTransparency=1,Image="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061\053\053\053\052\050\051\054\056\048\053",ScaleType=Enum.ScaleType.Slice;SliceCenter=Rect.new(23,23,277,277),Size=UDim2.fromScale(1,1)+UDim2.fromOffset(30,30);Position=UDim2.fromOffset(-15,-15);ImageColor3=Color3.fromRGB(0,0,0),ImageTransparency=.1})})local T=B("\070\114\097\109\101",{BackgroundTransparency=1;Size=UDim2.fromOffset(170,300),Parent=S.Library.GUI,Visible=false},{O;B("\085\073\083\105\122\101\067\111\110\115\116\114\097\105\110\116",{MinSize=Vector2.new(170,0)})})table.insert(F.OpenFrames,T)local function b()local z=0 if n.ViewportSize.Y-u.AbsolutePosition.Y<T.AbsoluteSize.Y-5 then z=((T.AbsoluteSize.Y-5)-(n.ViewportSize.Y-u.AbsolutePosition.Y))+40 end T.Position=UDim2.fromOffset(u.AbsolutePosition.X-1,(u.AbsolutePosition.Y-5)-z)end local w=0 local function Z()if#k.Values>10 then T.Size=UDim2.fromOffset(w,392)else T.Size=UDim2.fromOffset(w,y.AbsoluteContentSize.Y+10)end end local function e()j.CanvasSize=UDim2.fromOffset(0,y.AbsoluteContentSize.Y)end b()Z()f.AddSignal(u:GetPropertyChangedSignal("\065\098\115\111\108\117\116\101\080\111\115\105\116\105\111\110"),b)f.AddSignal(u.MouseButton1Click,function()k:Open()end)f.AddSignal(a.InputBegan,function(z)if z.UserInputType==Enum.UserInputType.MouseButton1 or z.UserInputType==Enum.UserInputType.Touch then local z,a=O.AbsolutePosition,O.AbsoluteSize if h.X<z.X or h.X>z.X+a.X or h.Y<(z.Y-20)-1 or h.Y>z.Y+a.Y then k:Close()end end end)local q=S.ScrollFrame function k.Open(a)k.Opened=true q.ScrollingEnabled=false T.Visible=true;(z:Create(O,TweenInfo.new(.2,Enum.EasingStyle.Quart,Enum.EasingDirection.Out),{Size=UDim2.fromScale(1,1)})):Play()end function k.Close(z)k.Opened=false q.ScrollingEnabled=true O.Size=UDim2.fromScale(1,.6)T.Visible=false end function k.Display(z)local a=k.Values local h=""if U.Multi then for z,a in next,a do if k.Value[a]then h=h..(a.."\044 ")end end h=h:sub(1,#h-2)else h=k.Value or""end i.Text=h==""and"--"or h end function k.GetActiveValues(z)if U.Multi then local z={}for a,h in next,k.Value do table.insert(z,a)end return z else return k.Value and 1 or 0 end end function k.BuildDropdownList(z)local a=k.Values local h={}for z,a in next,j:GetChildren()do if not a:IsA("\085\073\076\105\115\116\076\097\121\111\117\116")then a:Destroy()end end local n=0 for z,a in next,a do local P={}n=n+1 local s=B("\070\114\097\109\101",{Size=UDim2.fromOffset(4,14);BackgroundColor3=Color3.fromRGB(76,194,255);Position=UDim2.fromOffset(-1,16);AnchorPoint=Vector2.new(0,.5);ThemeTag={BackgroundColor3="\065\099\099\101\110\116"}},{B("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,2)})})local S=B("\084\101\120\116\076\097\098\101\108",{FontFace=Font.new("\114\098\120\097\115\115\101\116\058\047\047\102\111\110\116\115\047\102\097\109\105\108\105\101\115\047\071\111\116\104\097\109\083\083\109\046\106\115\111\110"),Text=a;TextColor3=Color3.fromRGB(200,200,200);TextSize=13,TextXAlignment=Enum.TextXAlignment.Left,BackgroundColor3=Color3.fromRGB(255,255,255),AutomaticSize=Enum.AutomaticSize.Y;BackgroundTransparency=1;Size=UDim2.fromScale(1,1),Position=UDim2.fromOffset(10,0),Name="\066\117\116\116\111\110\076\097\098\101\108";ThemeTag={TextColor3="\084\101\120\116"}})local r=B("\084\101\120\116\066\117\116\116\111\110",{Size=UDim2.new(1,-5,0,32),BackgroundTransparency=1;ZIndex=23;Text="",Parent=j,ThemeTag={BackgroundColor3="\068\114\111\112\100\111\119\110\079\112\116\105\111\110"}},{s,S,B("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,6)})})local i if U.Multi then i=k.Value[a]else i=k.Value==a end local c,u=f.SpringMotor(1,r,"\066\097\099\107\103\114\111\117\110\100\084\114\097\110\115\112\097\114\101\110\099\121")local y,O=f.SpringMotor(1,s,"\066\097\099\107\103\114\111\117\110\100\084\114\097\110\115\112\097\114\101\110\099\121")local T=M.SingleMotor.new(6)T:onStep(function(z)s.Size=UDim2.new(0,4,0,z)end)f.AddSignal(r.MouseEnter,function()u(i and.85 or.89)end)f.AddSignal(r.MouseLeave,function()u(i and.89 or 1)end)f.AddSignal(r.MouseButton1Down,function()u(.92)end)f.AddSignal(r.MouseButton1Up,function()u(i and.85 or.89)end)function P.UpdateButton(z)if U.Multi then i=k.Value[a]if i then u(.89)end else i=k.Value==a u(i and.89 or 1)end T:setGoal(M.Spring.new(i and 14 or 6,{frequency=6}))O(i and 0 or 1)end S.InputBegan:Connect(function(z)if z.UserInputType==Enum.UserInputType.MouseButton1 or z.UserInputType==Enum.UserInputType.Touch then local z=not i if k:GetActiveValues()==1 and(not z and not U.AllowNull)then else if U.Multi then i=z k.Value[a]=i and true or nil else i=z k.Value=i and a or nil for z,a in next,h do a:UpdateButton()end end P:UpdateButton()k:Display()F:SafeCallback(k.Callback,k.Value)F:SafeCallback(k.Changed,k.Value)end end end)P:UpdateButton()k:Display()h[r]=P end w=0 for z,a in next,h do if z.ButtonLabel then if z.ButtonLabel.TextBounds.X>w then w=z.ButtonLabel.TextBounds.X end end end w=w+30 e()Z()end function k.SetValues(a,z)if z then k.Values=z end k:BuildDropdownList()end function k.OnChanged(a,z)k.Changed=z z(k.Value)end function k.SetValue(a,z)if k.Multi then local a={}for z,h in next,z do if table.find(k.Values,z)then a[z]=true end end k.Value=a else if not z then k.Value=nil elseif table.find(k.Values,z)then k.Value=z end end k:BuildDropdownList()F:SafeCallback(k.Callback,k.Value)F:SafeCallback(k.Changed,k.Value)end function k.Destroy(z)r:Destroy()F.Options[P]=nil end k:BuildDropdownList()k:Display()local Q={}if type(U.Default)=="\115\116\114\105\110\103"then local z=table.find(k.Values,U.Default)if z then table.insert(Q,z)end elseif type(U.Default)=="\116\097\098\108\101"then for z,a in next,U.Default do local h=table.find(k.Values,a)if h then table.insert(Q,h)end end elseif type(U.Default)=="\110\117\109\098\101\114"and k.Values[U.Default]~=nil then table.insert(Q,U.Default)end if next(Q)then for z=1,#Q,1 do local a=Q[z]if U.Multi then k.Value[k.Values[a]]=true else k.Value=k.Values[a]end if not U.Multi then break end end k:BuildDropdownList()k:Display()end F.Options[P]=k return k end return U
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local Mouse = game:GetService("Players").LocalPlayer:GetMouse()
local Camera = game:GetService("Workspace").CurrentCamera

local Root = script.Parent.Parent
local Creator = require(Root.Creator)
local Flipper = require(Root.Packages.Flipper)

local New = Creator.New
local Components = Root.Components

local Element = {}
Element.__index = Element
Element.__type = "Dropdown"

function Element:New(Idx, Config)
	local Library = self.Library

	local Dropdown = {
		Values = Config.Values,
		Value = Config.Default,
		Multi = Config.Multi,
		Buttons = {},
		Opened = false,
		Type = "Dropdown",
		Callback = Config.Callback or function() end,
	}

	local DropdownFrame = require(Components.Element)(Config.Title, Config.Description, self.Container, false)
	DropdownFrame.DescLabel.Size = UDim2.new(1, -170, 0, 14)

	Dropdown.SetTitle = DropdownFrame.SetTitle
	Dropdown.SetDesc = DropdownFrame.SetDesc

	local DropdownDisplay = New("TextLabel", {
		FontFace = Font.new("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.Regular, Enum.FontStyle.Normal),
		Text = "Value",
		TextColor3 = Color3.fromRGB(240, 240, 240),
		TextSize = 13,
		TextXAlignment = Enum.TextXAlignment.Left,
		Size = UDim2.new(1, -30, 0, 14),
		Position = UDim2.new(0, 8, 0.5, 0),
		AnchorPoint = Vector2.new(0, 0.5),
		BackgroundColor3 = Color3.fromRGB(255, 255, 255),
		BackgroundTransparency = 1,
		TextTruncate = Enum.TextTruncate.AtEnd,
		ThemeTag = {
			TextColor3 = "Text",
		},
	})

	local DropdownIco = New("ImageLabel", {
		Image = "rbxassetid://10709790948",
		Size = UDim2.fromOffset(16, 16),
		AnchorPoint = Vector2.new(1, 0.5),
		Position = UDim2.new(1, -8, 0.5, 0),
		BackgroundTransparency = 1,
		ThemeTag = {
			ImageColor3 = "SubText",
		},
	})

	local DropdownInner = New("TextButton", {
		Size = UDim2.fromOffset(160, 30),
		Position = UDim2.new(1, -10, 0.5, 0),
		AnchorPoint = Vector2.new(1, 0.5),
		BackgroundTransparency = 0.9,
		Parent = DropdownFrame.Frame,
		ThemeTag = {
			BackgroundColor3 = "DropdownFrame",
		},
	}, {
		New("UICorner", {
			CornerRadius = UDim.new(0, 5),
		}),
		New("UIStroke", {
			Transparency = 0.5,
			ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
			ThemeTag = {
				Color = "InElementBorder",
			},
		}),
		DropdownIco,
		DropdownDisplay,
	})

	local DropdownListLayout = New("UIListLayout", {
		Padding = UDim.new(0, 3),
	})

	local DropdownScrollFrame = New("ScrollingFrame", {
		Size = UDim2.new(1, -5, 1, -10),
		Position = UDim2.fromOffset(5, 5),
		BackgroundTransparency = 1,
		BottomImage = "rbxassetid://6889812791",
		MidImage = "rbxassetid://6889812721",
		TopImage = "rbxassetid://6276641225",
		ScrollBarImageColor3 = Color3.fromRGB(255, 255, 255),
		ScrollBarImageTransparency = 0.95,
		ScrollBarThickness = 4,
		BorderSizePixel = 0,
		CanvasSize = UDim2.fromScale(0, 0),
	}, {
		DropdownListLayout,
	})

	local DropdownHolderFrame = New("Frame", {
		Size = UDim2.fromScale(1, 0.6),
		ThemeTag = {
			BackgroundColor3 = "DropdownHolder",
		},
	}, {
		DropdownScrollFrame,
		New("UICorner", {
			CornerRadius = UDim.new(0, 7),
		}),
		New("UIStroke", {
			ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
			ThemeTag = {
				Color = "DropdownBorder",
			},
		}),
		New("ImageLabel", {
			BackgroundTransparency = 1,
			Image = "http://www.roblox.com/asset/?id=5554236805",
			ScaleType = Enum.ScaleType.Slice,
			SliceCenter = Rect.new(23, 23, 277, 277),
			Size = UDim2.fromScale(1, 1) + UDim2.fromOffset(30, 30),
			Position = UDim2.fromOffset(-15, -15),
			ImageColor3 = Color3.fromRGB(0, 0, 0),
			ImageTransparency = 0.1,
		}),
	})

	local DropdownHolderCanvas = New("Frame", {
		BackgroundTransparency = 1,
		Size = UDim2.fromOffset(170, 300),
		Parent = self.Library.GUI,
		Visible = false,
	}, {
		DropdownHolderFrame,
		New("UISizeConstraint", {
			MinSize = Vector2.new(170, 0),
		}),
	})
	table.insert(Library.OpenFrames, DropdownHolderCanvas)

	local function RecalculateListPosition()
		local Add = 0
		if Camera.ViewportSize.Y - DropdownInner.AbsolutePosition.Y < DropdownHolderCanvas.AbsoluteSize.Y - 5 then
			Add = DropdownHolderCanvas.AbsoluteSize.Y
				- 5
				- (Camera.ViewportSize.Y - DropdownInner.AbsolutePosition.Y)
				+ 40
		end
		DropdownHolderCanvas.Position =
			UDim2.fromOffset(DropdownInner.AbsolutePosition.X - 1, DropdownInner.AbsolutePosition.Y - 5 - Add)
	end

	local ListSizeX = 0
	local function RecalculateListSize()
		if #Dropdown.Values > 10 then
			DropdownHolderCanvas.Size = UDim2.fromOffset(ListSizeX, 392)
		else
			DropdownHolderCanvas.Size = UDim2.fromOffset(ListSizeX, DropdownListLayout.AbsoluteContentSize.Y + 10)
		end
	end

	local function RecalculateCanvasSize()
		DropdownScrollFrame.CanvasSize = UDim2.fromOffset(0, DropdownListLayout.AbsoluteContentSize.Y)
	end

	RecalculateListPosition()
	RecalculateListSize()

	Creator.AddSignal(DropdownInner:GetPropertyChangedSignal("AbsolutePosition"), RecalculateListPosition)

	Creator.AddSignal(DropdownInner.MouseButton1Click, function()
		Dropdown:Open()
	end)

	Creator.AddSignal(UserInputService.InputBegan, function(Input)
		if
			Input.UserInputType == Enum.UserInputType.MouseButton1
			or Input.UserInputType == Enum.UserInputType.Touch
		then
			local AbsPos, AbsSize = DropdownHolderFrame.AbsolutePosition, DropdownHolderFrame.AbsoluteSize
			if
				Mouse.X < AbsPos.X
				or Mouse.X > AbsPos.X + AbsSize.X
				or Mouse.Y < (AbsPos.Y - 20 - 1)
				or Mouse.Y > AbsPos.Y + AbsSize.Y
			then
				Dropdown:Close()
			end
		end
	end)

	local ScrollFrame = self.ScrollFrame
	function Dropdown:Open()
		Dropdown.Opened = true
		ScrollFrame.ScrollingEnabled = false
		DropdownHolderCanvas.Visible = true
		TweenService:Create(
			DropdownHolderFrame,
			TweenInfo.new(0.2, Enum.EasingStyle.Quart, Enum.EasingDirection.Out),
			{ Size = UDim2.fromScale(1, 1) }
		):Play()
	end

	function Dropdown:Close()
		Dropdown.Opened = false
		ScrollFrame.ScrollingEnabled = true
		DropdownHolderFrame.Size = UDim2.fromScale(1, 0.6)
		DropdownHolderCanvas.Visible = false
	end

	function Dropdown:Display()
		local Values = Dropdown.Values
		local Str = ""

		if Config.Multi then
			for Idx, Value in next, Values do
				if Dropdown.Value[Value] then
					Str = Str .. Value .. ", "
				end
			end
			Str = Str:sub(1, #Str - 2)
		else
			Str = Dropdown.Value or ""
		end

		DropdownDisplay.Text = (Str == "" and "--" or Str)
	end

	function Dropdown:GetActiveValues()
		if Config.Multi then
			local T = {}

			for Value, Bool in next, Dropdown.Value do
				table.insert(T, Value)
			end

			return T
		else
			return Dropdown.Value and 1 or 0
		end
	end

	function Dropdown:BuildDropdownList()
		local Values = Dropdown.Values
		local Buttons = {}

		for _, Element in next, DropdownScrollFrame:GetChildren() do
			if not Element:IsA("UIListLayout") then
				Element:Destroy()
			end
		end

		local Count = 0

		for Idx, Value in next, Values do
			local Table = {}

			Count = Count + 1

			local ButtonSelector = New("Frame", {
				Size = UDim2.fromOffset(4, 14),
				BackgroundColor3 = Color3.fromRGB(76, 194, 255),
				Position = UDim2.fromOffset(-1, 16),
				AnchorPoint = Vector2.new(0, 0.5),
				ThemeTag = {
					BackgroundColor3 = "Accent",
				},
			}, {
				New("UICorner", {
					CornerRadius = UDim.new(0, 2),
				}),
			})

			local ButtonLabel = New("TextLabel", {
				FontFace = Font.new("rbxasset://fonts/families/GothamSSm.json"),
				Text = Value,
				TextColor3 = Color3.fromRGB(200, 200, 200),
				TextSize = 13,
				TextXAlignment = Enum.TextXAlignment.Left,
				BackgroundColor3 = Color3.fromRGB(255, 255, 255),
				AutomaticSize = Enum.AutomaticSize.Y,
				BackgroundTransparency = 1,
				Size = UDim2.fromScale(1, 1),
				Position = UDim2.fromOffset(10, 0),
				Name = "ButtonLabel",
				ThemeTag = {
					TextColor3 = "Text",
				},
			})

			local Button = New("TextButton", {
				Size = UDim2.new(1, -5, 0, 32),
				BackgroundTransparency = 1,
				ZIndex = 23,
				Text = "",
				Parent = DropdownScrollFrame,
				ThemeTag = {
					BackgroundColor3 = "DropdownOption",
				},
			}, {
				ButtonSelector,
				ButtonLabel,
				New("UICorner", {
					CornerRadius = UDim.new(0, 6),
				}),
			})

			local Selected

			if Config.Multi then
				Selected = Dropdown.Value[Value]
			else
				Selected = Dropdown.Value == Value
			end

			local BackMotor, SetBackTransparency = Creator.SpringMotor(1, Button, "BackgroundTransparency")
			local SelMotor, SetSelTransparency = Creator.SpringMotor(1, ButtonSelector, "BackgroundTransparency")
			local SelectorSizeMotor = Flipper.SingleMotor.new(6)

			SelectorSizeMotor:onStep(function(value)
				ButtonSelector.Size = UDim2.new(0, 4, 0, value)
			end)

			Creator.AddSignal(Button.MouseEnter, function()
				SetBackTransparency(Selected and 0.85 or 0.89)
			end)
			Creator.AddSignal(Button.MouseLeave, function()
				SetBackTransparency(Selected and 0.89 or 1)
			end)
			Creator.AddSignal(Button.MouseButton1Down, function()
				SetBackTransparency(0.92)
			end)
			Creator.AddSignal(Button.MouseButton1Up, function()
				SetBackTransparency(Selected and 0.85 or 0.89)
			end)

			function Table:UpdateButton()
				if Config.Multi then
					Selected = Dropdown.Value[Value]
					if Selected then
						SetBackTransparency(0.89)
					end
				else
					Selected = Dropdown.Value == Value
					SetBackTransparency(Selected and 0.89 or 1)
				end

				SelectorSizeMotor:setGoal(Flipper.Spring.new(Selected and 14 or 6, { frequency = 6 }))
				SetSelTransparency(Selected and 0 or 1)
			end

			ButtonLabel.InputBegan:Connect(function(Input)
				if
					Input.UserInputType == Enum.UserInputType.MouseButton1
					or Input.UserInputType == Enum.UserInputType.Touch
				then
					local Try = not Selected

					if Dropdown:GetActiveValues() == 1 and not Try and not Config.AllowNull then
					else
						if Config.Multi then
							Selected = Try
							Dropdown.Value[Value] = Selected and true or nil
						else
							Selected = Try
							Dropdown.Value = Selected and Value or nil

							for _, OtherButton in next, Buttons do
								OtherButton:UpdateButton()
							end
						end

						Table:UpdateButton()
						Dropdown:Display()

						Library:SafeCallback(Dropdown.Callback, Dropdown.Value)
						Library:SafeCallback(Dropdown.Changed, Dropdown.Value)
					end
				end
			end)

			Table:UpdateButton()
			Dropdown:Display()

			Buttons[Button] = Table
		end

		ListSizeX = 0
		for Button, Table in next, Buttons do
			if Button.ButtonLabel then
				if Button.ButtonLabel.TextBounds.X > ListSizeX then
					ListSizeX = Button.ButtonLabel.TextBounds.X
				end
			end
		end
		ListSizeX = ListSizeX + 30

		RecalculateCanvasSize()
		RecalculateListSize()
	end

	function Dropdown:SetValues(NewValues)
		if NewValues then
			Dropdown.Values = NewValues
		end

		Dropdown:BuildDropdownList()
	end

	function Dropdown:OnChanged(Func)
		Dropdown.Changed = Func
		Func(Dropdown.Value)
	end

	function Dropdown:SetValue(Val)
		if Dropdown.Multi then
			local nTable = {}

			for Value, Bool in next, Val do
				if table.find(Dropdown.Values, Value) then
					nTable[Value] = true
				end
			end

			Dropdown.Value = nTable
		else
			if not Val then
				Dropdown.Value = nil
			elseif table.find(Dropdown.Values, Val) then
				Dropdown.Value = Val
			end
		end

		Dropdown:BuildDropdownList()

		Library:SafeCallback(Dropdown.Callback, Dropdown.Value)
		Library:SafeCallback(Dropdown.Changed, Dropdown.Value)
	end

	function Dropdown:Destroy()
		DropdownFrame:Destroy()
		Library.Options[Idx] = nil
	end

	Dropdown:BuildDropdownList()
	Dropdown:Display()

	local Defaults = {}

	if type(Config.Default) == "string" then
		local Idx = table.find(Dropdown.Values, Config.Default)
		if Idx then
			table.insert(Defaults, Idx)
		end
	elseif type(Config.Default) == "table" then
		for _, Value in next, Config.Default do
			local Idx = table.find(Dropdown.Values, Value)
			if Idx then
				table.insert(Defaults, Idx)
			end
		end
	elseif type(Config.Default) == "number" and Dropdown.Values[Config.Default] ~= nil then
		table.insert(Defaults, Config.Default)
	end

	if next(Defaults) then
		for i = 1, #Defaults do
			local Index = Defaults[i]
			if Config.Multi then
				Dropdown.Value[Dropdown.Values[Index]] = true
			else
				Dropdown.Value = Dropdown.Values[Index]
			end

			if not Config.Multi then
				break
			end
		end

		Dropdown:BuildDropdownList()
		Dropdown:Display()
	end

	Library.Options[Idx] = Dropdown
	return Dropdown
end

return Element
