local function K()local K={}local n=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")local B=nil local D=nil function K.fire(K,...)B={...}D=select("\035",...)n:Fire()end function K.connect(f,K)if not K then error("\099\111\110\110\101\099\116\040\110\105\108\041",2)end return n.Event:Connect(function()K(unpack(B,1,D))end)end function K.wait(K)n.Event:wait()if not B then error("\077\105\115\115\105\110\103 \097\114\103 \100\097\116\097\044 \108\105\107\101\108\121 \100\117\101 \116\111 \058\084\119\101\101\110\083\105\122\101\047\080\111\115\105\116\105\111\110 \099\111\114\114\117\112\116\105\110\103 \116\104\114\101\097\100\114\101\102\115\046")end return unpack(B,1,D)end return K end local function n()while not workspace.CurrentCamera do workspace.Changed:wait()end while workspace.CurrentCamera.ViewportSize==Vector2.new(0,0)or workspace.CurrentCamera.ViewportSize==Vector2.new(1,1)do workspace.CurrentCamera.Changed:wait()end return workspace.CurrentCamera.ViewportSize end local function B()local K=n()return UserInputService.TouchEnabled and(K.Y<500 or K.X<700)end local function D()local K=n()return K.Y>K.X end local function f()return tenFootInterfaceEnabled end local function k()if VRService.VREnabled then return false end if UserInputService.TouchEnabled and not UserInputService.GamepadEnabled then return false end return true end local function I(K,n,B)local D,f=n.AbsolutePosition.x,n.AbsolutePosition.y local k,I=n.AbsoluteSize.x,n.AbsoluteSize.y local S,g=D+k,f+I return K.x>D and(K.x<S and(K.y>f and K.y<g))end local function S(K,n)if not I(K,n)then return false end local B=false local D=n while true do if D==nil or not D:IsA("\071\117\105\079\098\106\101\099\116")and not D:IsA("\076\097\121\101\114\067\111\108\108\101\099\116\111\114")then B=true if D and D:IsA("\067\111\114\101\071\117\105")then B=false end break end if D:IsA("\071\117\105\079\098\106\101\099\116")and not D.Visible then B=true break end if D:IsA("\076\097\121\101\114\067\111\108\108\101\099\116\111\114")or D.ClipsDescendants then if not I(K,D)then B=true break end end D=D.Parent end return not B end local function g(K,n)local B,D=K.AbsolutePosition.x,K.AbsolutePosition.y local f,k=K.AbsoluteSize.x,K.AbsoluteSize.y local I,S=B+f,D+k local g,V=n.AbsolutePosition.x,n.AbsolutePosition.y local o,Y=n.AbsoluteSize.x,n.AbsoluteSize.y local t,q=g+o,V+Y local d=B<t and I>g local X=D<q and S>V local E=d and X return E end local function V(K,n)local B=false local D=K while true do if D==nil or not D:IsA("\071\117\105\079\098\106\101\099\116")and not D:IsA("\076\097\121\101\114\067\111\108\108\101\099\116\111\114")then B=true if D and D:IsA("\067\111\114\101\071\117\105")then B=false end break end if D:IsA("\071\117\105\079\098\106\101\099\116")and not D.Visible then B=true break end if D:IsA("\076\097\121\101\114\067\111\108\108\101\099\116\111\114")or D.ClipsDescendants then if not g(D,K)then B=true break end end D=D.Parent end return not B end local function o(K,n,B,D)local function f()if K.Active then B(n)end end local function k()if K.Active then D(n)end end K.MouseEnter:Connect(k)K.SelectionGained:Connect(k)K.MouseLeave:Connect(f)K.SelectionLost:Connect(f)B(n)end local function Y(K,B)onResizedCallbacks[K]=B B(n(),D())end local t={[Enum.UserInputType.Gamepad1]=true;[Enum.UserInputType.Gamepad2]=true,[Enum.UserInputType.Gamepad3]=true,[Enum.UserInputType.Gamepad4]=true;[Enum.UserInputType.Gamepad5]=true;[Enum.UserInputType.Gamepad6]=true;[Enum.UserInputType.Gamepad7]=true,[Enum.UserInputType.Gamepad8]=true}local function q(K,n,B,D,f)local I=(Util.Create("\073\109\097\103\101\076\097\098\101\108"))({Image="";BackgroundTransparency=1})local S=(Util.Create("\073\109\097\103\101\066\117\116\116\111\110"))({Name=K.."\066\117\116\116\111\110";Image="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\083\101\116\116\105\110\103\115\047\077\101\110\117\066\097\114\065\115\115\101\116\115\047\077\101\110\117\066\117\116\116\111\110\046\112\110\103",ScaleType=Enum.ScaleType.Slice;SliceCenter=Rect.new(8,6,46,44),AutoButtonColor=false;BackgroundTransparency=1;Size=n,ZIndex=2;SelectionImageObject=I})local g=(Util.Create("\066\111\111\108\086\097\108\117\101"))({Name="\069\110\097\098\108\101\100";Parent=S;Value=true})if B then S.MouseButton1Click:Connect(function()B(t[UserInputService:GetLastInputType()]or false)end)end local function V(K)return K.UserInputType==Enum.UserInputType.MouseMovement or K.UserInputType==Enum.UserInputType.Touch end local o=nil local function Y(K)o=K end local function q()local K=f if K==nil then if D then K=D.HubRef end end if K and K.Active or K==nil then S.Image="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\083\101\116\116\105\110\103\115\047\077\101\110\117\066\097\114\065\115\115\101\116\115\047\077\101\110\117\066\117\116\116\111\110\083\101\108\101\099\116\101\100\046\112\110\103"local n=S if o then n=o end if K then K:ScrollToFrame(n)end end end local function d()S.Image="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\083\101\116\116\105\110\103\115\047\077\101\110\117\066\097\114\065\115\115\101\116\115\047\077\101\110\117\066\117\116\116\111\110\046\112\110\103"end S.InputBegan:Connect(function(K)if S.Selectable and V(K)then q()end end)S.InputEnded:Connect(function(K)if S.Selectable and(GuiService.SelectedCoreObject~=S and V(K))then d()end end)S.SelectionGained:Connect(function()q()end)S.SelectionLost:Connect(function()d()end)local X=GuiService.Changed:Connect(function(K)if K~="\083\101\108\101\099\116\101\100\067\111\114\101\079\098\106\101\099\116"then return end if not k()then return end if GuiService.SelectedCoreObject==nil or GuiService.SelectedCoreObject~=S then d()return end if S.Selectable then q()end end)return S,Y end local function d(K,n,D,k,I,S)local g,V=q(K,D,k,I,S)local o=(Util.Create("\084\101\120\116\076\097\098\101\108"))({Name=K.."\084\101\120\116\076\097\098\101\108",BackgroundTransparency=1;BorderSizePixel=0;Size=UDim2.new(1,0,1,-8);Position=UDim2.new(0,0,0,0);TextColor3=Color3.fromRGB(255,255,255),TextYAlignment=Enum.TextYAlignment.Center;Font=Enum.Font.SourceSansBold,TextSize=24,Text=n,TextScaled=true;TextWrapped=true;ZIndex=2,Parent=g})local Y=Instance.new("\085\073\084\101\120\116\083\105\122\101\067\111\110\115\116\114\097\105\110\116",o)if B()then o.TextSize=18 elseif f()then o.TextSize=36 end Y.MaxTextSize=o.TextSize return g,o,V end local function X(K,n,B,D,f,k,I)local S,g=q(K,B,f,k,I)local V=(Util.Create("\073\109\097\103\101\076\097\098\101\108"))({Name=K.."\073\109\097\103\101\076\097\098\101\108";BackgroundTransparency=1,BorderSizePixel=0;Size=D;Position=UDim2.new(.5,0,.5,0),AnchorPoint=Vector2.new(.5,.5);Image=n;ZIndex=2;Parent=S})return S,V,g end local function E(K,n,B,D,f,k)local I,S,g=d(n,B,D,f,K,k)local V=(Util.Create("\070\114\097\109\101"))({Name=n.."\082\111\119";BackgroundTransparency=1;Size=UDim2.new(1,0,D.Y.Scale,D.Y.Offset),Parent=K.Page})I.Parent=V I.AnchorPoint=Vector2.new(1,0)I.Position=UDim2.new(1,-20,0,0)return V,I,S,g end local function u(K,n,B)local D="\067\104\111\111\115\101 \079\110\101"local f=25 local I=Color3.fromRGB(178,178,178)local S=Color3.fromRGB(229,229,229)local g=Color3.fromRGB(255,255,255)local V=nil local o={}o.CurrentIndex=nil local Y=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")Y.Name="\073\110\100\101\120\067\104\097\110\103\101\100"if type(K)~="\116\097\098\108\101"then error("\067\114\101\097\116\101\068\114\111\112\068\111\119\110 \100\114\111\112\068\111\119\110\083\116\114\105\110\103\084\097\098\108\101 \040\102\105\114\115\116 \097\114\103\041 \105\115 \110\111\116 \097 \116\097\098\108\101",2)return o end local t=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")t.Name="\073\110\100\101\120\067\104\097\110\103\101\100"local q=true local X=HttpService:GenerateGUID(false)local E local u=K local U=(Util.Create("\073\109\097\103\101\066\117\116\116\111\110"))({Name="\068\114\111\112\068\111\119\110\070\117\108\108\115\099\114\101\101\110\070\114\097\109\101",BackgroundTransparency=DROPDOWN_BG_TRANSPARENCY;BorderSizePixel=0;Size=UDim2.new(1,0,1,0),BackgroundColor3=Color3.fromRGB(0,0,0);ZIndex=10;Active=true,Visible=false;Selectable=false;AutoButtonColor=false;Parent=CoreGui.RobloxGui})local function m(K)if K~="\086\082\069\110\097\098\108\101\100"then return end if VRService.VREnabled then local K=require(CoreGui.RobloxGui.Modules.VR.Panel3D)U.Parent=(K.Get("\083\101\116\116\105\110\103\115\077\101\110\117")):GetGUI()U.BackgroundTransparency=1 else U.Parent=CoreGui.RobloxGui U.BackgroundTransparency=DROPDOWN_BG_TRANSPARENCY end if o.UpdateDropDownList then o:UpdateDropDownList(u)end end VRService.Changed:Connect(m)m("\086\082\069\110\097\098\108\101\100")local s=(Util.Create("\073\109\097\103\101\076\097\098\101\108"))({Name="\068\114\111\112\068\111\119\110\083\101\108\101\099\116\105\111\110\070\114\097\109\101";Image="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\083\101\116\116\105\110\103\115\047\077\101\110\117\066\097\114\065\115\115\101\116\115\047\077\101\110\117\066\117\116\116\111\110\046\112\110\103",ScaleType=Enum.ScaleType.Slice;SliceCenter=Rect.new(8,6,46,44);BackgroundTransparency=1;Size=UDim2.new(.6,0,.9,0);Position=UDim2.new(.5,0,.5,0);AnchorPoint=Vector2.new(.5,.5),ZIndex=10,Parent=U})local A=(Util.Create("\083\099\114\111\108\108\105\110\103\070\114\097\109\101"))({Name="\068\114\111\112\068\111\119\110\083\099\114\111\108\108\105\110\103\070\114\097\109\101";BackgroundTransparency=1,BorderSizePixel=0;Size=UDim2.new(1,-20,1,-f);Position=UDim2.new(0,10,0,10),ZIndex=10;Parent=s})local F=nil local W=false local p=function(K,n)if K~=nil and n~=Enum.UserInputState.Begin then return end o.DropDownFrame.Selectable=q B:SetActive(true)if U.Visible and k()then GuiService.SelectedCoreObject=V end U.Visible=false if F then F:Disconnect()end ContextActionService:UnbindAction(X.."\065\099\116\105\111\110")ContextActionService:UnbindAction(X.."\070\114\101\101\122\101\065\099\116\105\111\110")E.Value=q W=false if VRService.VREnabled then local K=require(CoreGui.RobloxGui.Modules.VR.Panel3D);(K.Get("\083\101\116\116\105\110\103\115\077\101\110\117")):SetSubpanelDepth(U,0)end end local h=function() end local L=function()if not q then return end o.DropDownFrame.Selectable=false W=true U.Visible=true if VRService.VREnabled then local K=require(CoreGui.RobloxGui.Modules.VR.Panel3D);(K.Get("\083\101\116\116\105\110\103\115\077\101\110\117")):SetSubpanelDepth(U,.5)end V=o.DropDownFrame if o.CurrentIndex and o.CurrentIndex>0 then GuiService.SelectedCoreObject=o.Selections[o.CurrentIndex]end F=(GuiService:GetPropertyChangedSignal("\083\101\108\101\099\116\101\100\067\111\114\101\079\098\106\101\099\116")):Connect(function()for K=1,#o.Selections,1 do if GuiService.SelectedCoreObject==o.Selections[K]then o.Selections[K].TextColor3=g else o.Selections[K].TextColor3=VRService.VREnabled and S or I end end end)ContextActionService:BindActionAtPriority(X.."\070\114\101\101\122\101\065\099\116\105\111\110",h,false,Enum.ContextActionPriority.High.Value,Enum.UserInputType.Keyboard,Enum.UserInputType.Gamepad1)ContextActionService:BindActionAtPriority(X.."\065\099\116\105\111\110",p,false,Enum.ContextActionPriority.High.Value,Enum.KeyCode.ButtonB,Enum.KeyCode.Escape)B:SetActive(false)E.Value=false end local i=UDim2.new(.6,0,0,50)o.DropDownFrame=d("\068\114\111\112\068\111\119\110\070\114\097\109\101",D,i,L,nil,B)o.DropDownFrame.Position=UDim2.new(1,0,.5,0)o.DropDownFrame.AnchorPoint=Vector2.new(1,.5)E=o.DropDownFrame.Enabled local Q=o.DropDownFrame.DropDownFrameTextLabel Q.Position=UDim2.new(0,15,0,0)Q.Size=UDim2.new(1,-50,1,-8)Q.ClipsDescendants=true Q.TextXAlignment=Enum.TextXAlignment.Left local P=(Util.Create("\073\109\097\103\101\076\097\098\101\108"))({Name="\068\114\111\112\068\111\119\110\073\109\097\103\101";Image="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\083\101\116\116\105\110\103\115\047\068\114\111\112\068\111\119\110\047\068\114\111\112\068\111\119\110\046\112\110\103";BackgroundTransparency=1,AnchorPoint=Vector2.new(1,.5);Size=UDim2.new(0,15,0,10);Position=UDim2.new(1,-12,.5,0),ZIndex=2,Parent=o.DropDownFrame})o.DropDownImage=P local function M(K)local n=false for B,D in pairs(o.Selections)do if B==K then Q.Text=D.Text o.CurrentIndex=B n=true end end if n then t:Fire(K)end end local function z(K)local n=false for B,D in pairs(o.Selections)do if D.Text==K then Q.Text=D.Text o.CurrentIndex=B n=true end end if n then t:Fire(o.CurrentIndex)end return n end local O=false local function a(K)if K.UserInputState==Enum.UserInputState.Begin then if K.KeyCode==Enum.KeyCode.Return then if GuiService.SelectedCoreObject==o.DropDownFrame or o.SelectionInfo and o.SelectionInfo[GuiService.SelectedCoreObject]then O=true end end elseif K.UserInputState==Enum.UserInputState.End then if K.KeyCode==Enum.KeyCode.Return and O then O=false if GuiService.SelectedCoreObject==o.DropDownFrame then L()elseif o.SelectionInfo and o.SelectionInfo[GuiService.SelectedCoreObject]then local K=o.SelectionInfo[GuiService.SelectedCoreObject]K.Clicked()end end end end local function Z(K)if K then o.DropDownFrame.DropDownFrameTextLabel.TextTransparency=.5 o.DropDownFrame.ImageTransparency=.5 o.DropDownImage.ImageTransparency=.5 else o.DropDownFrame.DropDownFrameTextLabel.TextTransparency=0 o.DropDownFrame.ImageTransparency=0 o.DropDownImage.ImageTransparency=0 end end o.IndexChanged=t.Event function o.SetSelectionIndex(n,K)M(K)end function o.SetSelectionByValue(n,K)return z(K)end function o.ResetSelectionIndex(K)o.CurrentIndex=nil Q.Text=D p()end function o.GetSelectedIndex(K)return o.CurrentIndex end function o.SetZIndex(n,K)o.DropDownFrame.ZIndex=K P.ZIndex=K Q.ZIndex=K end function o.SetInteractable(n,K)q=K o.DropDownFrame.Selectable=q if not q then p()Z(VRService.VREnabled)if not VRService.VREnabled then o:SetZIndex(1)end else Z(false)if not VRService.VREnabled then o:SetZIndex(2)end end E.Value=K and not W end function o.UpdateDropDownList(B,K)u=K if o.Selections then for K=1,#o.Selections,1 do o.Selections[K]:Destroy()end end o.Selections={}o.SelectionInfo={}local D=VRService.VREnabled local V=D and Enum.Font.SourceSansBold or Enum.Font.SourceSans local Y=D and 36 or 24 local q=D and 70 or 50 local d=q+1 local E=D and 600 or 400 for K,B in pairs(K)do local D=(Util.Create("\070\114\097\109\101"))({BackgroundTransparency=.7;BorderSizePixel=0,Size=UDim2.new(1,0,1,0)})local f=(Util.Create("\084\101\120\116\066\117\116\116\111\110"))({Name="\083\101\108\101\099\116\105\111\110"..tostring(K),BackgroundTransparency=1;BorderSizePixel=0,AutoButtonColor=false,Size=UDim2.new(1,-28,0,q);Position=UDim2.new(0,14,0,(K-1)*d);TextColor3=VRService.VREnabled and S or I,Font=V;TextSize=Y;Text=B;ZIndex=10,SelectionImageObject=D;Parent=A})if K==n then o.CurrentIndex=K Q.Text=B f.TextColor3=g elseif not n and K==1 then f.TextColor3=g end local X=function()Q.Text=f.Text p()o.CurrentIndex=K t:Fire(K)end f.MouseButton1Click:Connect(X)f.MouseEnter:Connect(function()if k()then GuiService.SelectedCoreObject=f end end)o.Selections[K]=f o.SelectionInfo[f]={Clicked=X}end GuiService:RemoveSelectionGroup(X)GuiService:AddSelectionTuple(X,unpack(o.Selections))A.CanvasSize=UDim2.new(1,-20,0,#K*d)local function m()if A.CanvasSize.Y.Offset<U.AbsoluteSize.Y-10 then s.Size=UDim2.new(0,E,0,A.CanvasSize.Y.Offset+f)else s.Size=UDim2.new(0,E,.9,0)end end U.Changed:Connect(function(K)if K~="\065\098\115\111\108\117\116\101\083\105\122\101"then return end m()end)m()end o:UpdateDropDownList(K)U.MouseButton1Click:Connect(p)B.PoppedMenu:Connect(function(K)if K==U then p()end end)return o end local function U(K,n)local B=0 local D=.15 local I={}I.HubRef=nil if type(K)~="\116\097\098\108\101"then error("\067\114\101\097\116\101\083\101\108\101\099\116\111\114 \115\101\108\101\099\116\105\111\110\083\116\114\105\110\103\084\097\098\108\101 \040\102\105\114\115\116 \097\114\103\041 \105\115 \110\111\116 \097 \116\097\098\108\101",2)return I end local S=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")S.Name="\073\110\100\101\120\067\104\097\110\103\101\100"local g=true I.CurrentIndex=0 I.SelectorFrame=(Util.Create("\073\109\097\103\101\066\117\116\116\111\110"))({Name="\083\101\108\101\099\116\111\114",Image="",AutoButtonColor=false;NextSelectionLeft=I.SelectorFrame,NextSelectionRight=I.SelectorFrame,BackgroundTransparency=1;Size=UDim2.new(.6,0,0,50);Position=UDim2.new(1,0,.5,0);AnchorPoint=Vector2.new(1,.5),ZIndex=2;SelectionImageObject=noSelectionObject})local V=(Util.Create("\073\109\097\103\101\066\117\116\116\111\110"))({Name="\076\101\102\116\066\117\116\116\111\110",BackgroundTransparency=1;AnchorPoint=Vector2.new(0,.5),Position=UDim2.new(0,0,.5,0),Size=UDim2.new(0,50,0,50);Image="",ZIndex=3;Selectable=false;SelectionImageObject=noSelectionObject,Parent=I.SelectorFrame})local t=(Util.Create("\073\109\097\103\101\066\117\116\116\111\110"))({Name="\082\105\103\104\116\066\117\116\116\111\110";BackgroundTransparency=1,AnchorPoint=Vector2.new(1,.5),Position=UDim2.new(1,0,.5,0);Size=UDim2.new(0,50,0,50),Image="",ZIndex=3;Selectable=false;SelectionImageObject=noSelectionObject,Parent=I.SelectorFrame})local q=(Util.Create("\073\109\097\103\101\076\097\098\101\108"))({Name="\076\101\102\116\066\117\116\116\111\110";BackgroundTransparency=1;AnchorPoint=Vector2.new(.5,.5);Position=UDim2.new(.5,0,.5,0),Size=UDim2.new(0,18,0,30);Image="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\083\101\116\116\105\110\103\115\047\083\108\105\100\101\114\047\076\101\102\116\046\112\110\103";ImageColor3=ARROW_COLOR;ZIndex=4;Parent=V})local d=(Util.Create("\073\109\097\103\101\076\097\098\101\108"))({Name="\082\105\103\104\116\066\117\116\116\111\110",BackgroundTransparency=1,AnchorPoint=Vector2.new(.5,.5);Position=UDim2.new(.5,0,.5,0),Size=UDim2.new(0,18,0,30),Image="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\083\101\116\116\105\110\103\115\047\083\108\105\100\101\114\047\082\105\103\104\116\046\112\110\103";ImageColor3=ARROW_COLOR;ZIndex=4,Parent=t})if not UserInputService.TouchEnabled then local K,n=function(K)K.ImageColor3=ARROW_COLOR end,function(K)K.ImageColor3=ARROW_COLOR_HOVER end o(V,q,K,n)o(t,d,K,n)end I.Selections={}local X={}local E={}local u=(Util.Create("\073\109\097\103\101\066\117\116\116\111\110"))({Name="\065\117\116\111\083\101\108\101\099\116\066\117\116\116\111\110";BackgroundTransparency=1;Image="",Position=UDim2.new(0,V.Size.X.Offset,0,0);Size=UDim2.new(1,V.Size.X.Offset*-2,1,0),Parent=I.SelectorFrame;ZIndex=2,SelectionImageObject=noSelectionObject})u.MouseButton1Click:Connect(function()if not g then return end if#I.Selections<=1 then return end local K=I.CurrentIndex+1 if K>#I.Selections then K=1 end I:SetSelectionIndex(K)if k()then GuiService.SelectedCoreObject=I.SelectorFrame end end)E[u]=true local function U(K,n)for B,f in pairs(I.Selections)do local k=B==K local g=UDim2.new(0,V.Size.X.Offset,0,0)local o=UDim2.new(0,(V.Size.X.Offset*n)*3,0,0)if X[f]then o=UDim2.new(0,(V.Size.X.Offset*-n)*3,0,0)end if o.X.Offset<0 then o=UDim2.new(0,o.X.Offset+f.AbsoluteSize.X/4,0,0)end if k then X[f]=true f.Position=o f.Visible=true PropertyTweener(f,"\084\101\120\116\084\114\097\110\115\112\097\114\101\110\099\121",1,0,D*1.1,EaseOutQuad)if f:IsDescendantOf(game)then f:TweenPosition(g,Enum.EasingDirection.In,Enum.EasingStyle.Quad,D,true)else f.Position=g end I.CurrentIndex=B S:Fire(K)elseif X[f]then X[f]=false PropertyTweener(f,"\084\101\120\116\084\114\097\110\115\112\097\114\101\110\099\121",0,1,D*1.1,EaseOutQuad)if f:IsDescendantOf(game)then f:TweenPosition(o,Enum.EasingDirection.Out,Enum.EasingStyle.Quad,D*.9,true)else f.Position=UDim2.new(o)end end end end local function m(K,n)if not g then return end if K~=nil and(K.UserInputType~=Enum.UserInputType.MouseButton1 and(K.UserInputType~=Enum.UserInputType.Gamepad1 and(K.UserInputType~=Enum.UserInputType.Gamepad2 and(K.UserInputType~=Enum.UserInputType.Gamepad3 and(K.UserInputType~=Enum.UserInputType.Gamepad4 and K.UserInputType~=Enum.UserInputType.Keyboard)))))then return end if k()then GuiService.SelectedCoreObject=I.SelectorFrame end local B=n+I.CurrentIndex local D=0 if B>I.CurrentIndex then D=1 else D=-1 end if B>#I.Selections then B=1 elseif B<1 then B=#I.Selections end U(B,D)end local s=nil local function A()s=(GuiService:GetPropertyChangedSignal("\083\101\108\101\099\116\101\100\067\111\114\101\079\098\106\101\099\116")):Connect(function()if#I.Selections<=0 then return end if GuiService.SelectedCoreObject==I.SelectorFrame then I.Selections[I.CurrentIndex].TextTransparency=0 else if GuiService.SelectedCoreObject~=nil and E[GuiService.SelectedCoreObject]then if VRService.VREnabled then I.Selections[I.CurrentIndex].TextTransparency=0 else GuiService.SelectedCoreObject=I.SelectorFrame end else I.Selections[I.CurrentIndex].TextTransparency=.5 end end end)end I.IndexChanged=S.Event function I.SetSelectionIndex(n,K)U(K,1)end function I.GetSelectedIndex(K)return I.CurrentIndex end function I.SetZIndex(n,K)V.ZIndex=K t.ZIndex=K q.ZIndex=K d.ZIndex=K for n=1,#I.Selections,1 do I.Selections[n].ZIndex=K end end function I.SetInteractable(n,K)g=K I.SelectorFrame.Selectable=g V.Active=g t.Active=g if not g then for K,n in pairs(I.Selections)do n.TextColor3=Color3.fromRGB(49,49,49)end q.ImageColor3=ARROW_COLOR_INACTIVE d.ImageColor3=ARROW_COLOR_INACTIVE else for K,n in pairs(I.Selections)do n.TextColor3=Color3.fromRGB(255,255,255)end q.ImageColor3=ARROW_COLOR d.ImageColor3=ARROW_COLOR end end function I.UpdateOptions(B,K)for K,n in pairs(I.Selections)do n:Destroy()end X={}I.Selections={}for K,B in pairs(K)do local D=(Util.Create("\084\101\120\116\076\097\098\101\108"))({Name="\083\101\108\101\099\116\105\111\110"..tostring(K);BackgroundTransparency=1;BorderSizePixel=0,Size=UDim2.new(1,V.Size.X.Offset*-2,1,0),Position=UDim2.new(1,0,0,0),TextColor3=Color3.fromRGB(255,255,255),TextYAlignment=Enum.TextYAlignment.Center;TextTransparency=.5,Font=Enum.Font.SourceSans,TextSize=24,Text=B;ZIndex=2,Visible=false;Parent=I.SelectorFrame})if f()then D.TextSize=36 end if K==n then I.CurrentIndex=K D.Position=UDim2.new(0,V.Size.X.Offset,0,0)D.Visible=true X[D]=true else X[D]=false end I.Selections[K]=D end local D=#I.Selections>1 V.Visible=D t.Visible=D end local function F(K)if K~="\086\082\069\110\097\098\108\101\100"then return end local n=VRService.VREnabled V.Selectable=n t.Selectable=n u.Selectable=n end VRService.Changed:Connect(F)F("\086\082\069\110\097\098\108\101\100")V.InputBegan:Connect(function(K)if K.UserInputType==Enum.UserInputType.Touch then m(nil,-1)end end)V.MouseButton1Click:Connect(function()if not UserInputService.TouchEnabled then m(nil,-1)end end)t.InputBegan:Connect(function(K)if K.UserInputType==Enum.UserInputType.Touch then m(nil,1)end end)t.MouseButton1Click:Connect(function()if not UserInputService.TouchEnabled then m(nil,1)end end)local W=true I:UpdateOptions(K)UserInputService.InputBegan:Connect(function(K)if not g then return end if not W then return end if K.UserInputType~=Enum.UserInputType.Gamepad1 and K.UserInputType~=Enum.UserInputType.Keyboard then return end if GuiService.SelectedCoreObject~=I.SelectorFrame then return end if K.KeyCode==Enum.KeyCode.DPadLeft or K.KeyCode==Enum.KeyCode.Left or K.KeyCode==Enum.KeyCode.A then m(K,-1)elseif K.KeyCode==Enum.KeyCode.DPadRight or K.KeyCode==Enum.KeyCode.Right or K.KeyCode==Enum.KeyCode.D then m(K,1)end end)UserInputService.InputChanged:Connect(function(K)if not g then return end if not W then B=0 return end if K.UserInputType~=Enum.UserInputType.Gamepad1 then return end local n=GuiService.SelectedCoreObject if not n or not n:IsDescendantOf(I.SelectorFrame.Parent)then return end if K.KeyCode~=Enum.KeyCode.Thumbstick1 then return end if K.Position.X>CONTROLLER_THUMBSTICK_DEADZONE and(K.Delta.X>0 and B~=1)then B=1 m(K,B)elseif K.Position.X<-CONTROLLER_THUMBSTICK_DEADZONE and(K.Delta.X<0 and B~=-1)then B=-1 m(K,B)elseif math.abs(K.Position.X)<CONTROLLER_THUMBSTICK_DEADZONE then B=0 end end)I.SelectorFrame.AncestryChanged:Connect(function(K,n)W=n if not W then if s then s:Disconnect()end else A()end end)local function p(K,n)local B=0 if n then B=16 else B=f()and 36 or 24 end for K,n in pairs(I.Selections)do n.TextSize=B end end Y(I.SelectorFrame,p)A()return I end local function m(K,n,B,D,f)local I=CoreGui.RobloxGui if I:FindFirstChild("\065\108\101\114\116\086\105\101\119\070\117\108\108\083\099\114\101\101\110")then return end local S=nil local function g(K)if K~="\086\082\069\110\097\098\108\101\100"then return end local n,B=nil,nil if VRService.VREnabled then n=require(CoreGui.RobloxGui.Modules.VR.Panel3D)B=n.Get("\083\101\116\116\105\110\103\115\077\101\110\117")I=B:GetGUI()else I=CoreGui.RobloxGui end if S and S.Parent~=nil then S.Parent=I if VRService.VREnabled then B:SetSubpanelDepth(S,.5)end end end local V=VRService.Changed:Connect(g)local o=Color3.fromRGB(59,166,241)local Y=Color3.fromRGB(255,255,255)S=(Util.Create("\073\109\097\103\101\076\097\098\101\108"))({Name="\065\108\101\114\116\086\105\101\119\066\097\099\107\105\110\103";Image="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\083\101\116\116\105\110\103\115\047\077\101\110\117\066\097\114\065\115\115\101\116\115\047\077\101\110\117\066\117\116\116\111\110\046\112\110\103",ScaleType=Enum.ScaleType.Slice;SliceCenter=Rect.new(8,6,46,44);BackgroundTransparency=1,ImageTransparency=1,Size=UDim2.new(0,400,0,350);Position=UDim2.new(.5,-200,.5,-175);ZIndex=9;Parent=I})g("\086\082\069\110\097\098\108\101\100")if f or VRService.VREnabled then S.ImageTransparency=0 else S.Size=UDim2.new(.8,0,0,350)S.Position=UDim2.new(.1,0,.1,0)end if CoreGui.RobloxGui.AbsoluteSize.Y<=S.Size.Y.Offset then S.Size=UDim2.new(S.Size.X.Scale,S.Size.X.Offset,S.Size.Y.Scale,CoreGui.RobloxGui.AbsoluteSize.Y)S.Position=UDim2.new(S.Position.X.Scale,-S.Size.X.Offset/2,.5,-S.Size.Y.Offset/2)end local t=(Util.Create("\084\101\120\116\076\097\098\101\108"))({Name="\065\108\101\114\116\086\105\101\119\084\101\120\116";BackgroundTransparency=1,Size=UDim2.new(.95,0,.6,0);Position=UDim2.new(.025,0,.05,0);Font=Enum.Font.SourceSansBold;TextSize=36,Text=K;TextWrapped=true,TextColor3=Color3.fromRGB(255,255,255);TextXAlignment=Enum.TextXAlignment.Center;TextYAlignment=Enum.TextYAlignment.Center,ZIndex=10;Parent=S})local q=(Util.Create("\073\109\097\103\101\076\097\098\101\108"))({Image="";BackgroundTransparency=1})local X=HttpService:GenerateGUID(false)local E=function(K,n)if VRService.VREnabled and(n==Enum.UserInputState.Begin or n==Enum.UserInputState.Cancel)then return end if not S then return end if VRService.VREnabled then local K=require(CoreGui.RobloxGui.Modules.VR.Panel3D);(K.Get("\083\101\116\116\105\110\103\115\077\101\110\117")):SetSubpanelDepth(S,0)end S:Destroy()S=nil if D then D()end ContextActionService:UnbindAction(X)GuiService.SelectedCoreObject=nil if B then B:ShowBar()end if V then V:Disconnect()end end local u=UDim2.new(1,-20,0,60)local U=UDim2.new(0,10,.65,0)if not f then u=UDim2.new(0,200,0,50)U=UDim2.new(.5,-100,.65,0)end local m,s=d("\065\108\101\114\116\086\105\101\119\066\117\116\116\111\110",n,u,E)m.Position=U m.NextSelectionLeft=m m.NextSelectionRight=m m.NextSelectionUp=m m.NextSelectionDown=m m.ZIndex=9 s.ZIndex=m.ZIndex m.Parent=S if k()then GuiService.SelectedCoreObject=m end GuiService.SelectedCoreObject=m ContextActionService:BindActionAtPriority(X,E,false,Enum.ContextActionPriority.High.Value,Enum.KeyCode.Escape,Enum.KeyCode.ButtonB,Enum.KeyCode.ButtonA)if B and not VRService.VREnabled then B:HideBar()B.Pages.CurrentPage:Hide(1,1)end end local function s(K,n,D)local f={}local I=4 local S=8 local g=tonumber(K)local V=n local Y=0 local t=nil local q=true local d=HttpService:GenerateGUID(false)K=""n=""if g<=0 then error("\067\114\101\097\116\101\078\101\119\083\108\105\100\101\114 \102\097\105\108\101\100 \098\101\099\097\117\115\101 \110\117\109\079\102\083\116\101\112\115 \040\102\105\114\115\116 \097\114\103\041 \105\115 \048 \111\114 \110\101\103\097\116\105\118\101\044 \112\108\101\097\115\101 \115\117\112\112\108\121 \097 \112\111\115\105\116\105\118\101 \105\110\116\101\103\101\114",2)return end local X=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")X.Name="\086\097\108\117\101\067\104\097\110\103\101\100"f.SliderFrame=(Util.Create("\073\109\097\103\101\066\117\116\116\111\110"))({Name="\083\108\105\100\101\114",Image="",AutoButtonColor=false;NextSelectionLeft=f.SliderFrame,NextSelectionRight=f.SliderFrame,BackgroundTransparency=1;Size=UDim2.new(.6,0,0,50);Position=UDim2.new(1,0,.5,0),AnchorPoint=Vector2.new(1,.5);SelectionImageObject=noSelectionObject,ZIndex=2})f.StepsContainer=(Util.Create("\070\114\097\109\101"))({Name="\083\116\101\112\115\067\111\110\116\097\105\110\101\114",Position=UDim2.new(.5,0,.5,0);Size=UDim2.new(1,-100,1,0);AnchorPoint=Vector2.new(.5,.5);BackgroundTransparency=1,Parent=f.SliderFrame})local E=(Util.Create("\073\109\097\103\101\066\117\116\116\111\110"))({Name="\076\101\102\116\066\117\116\116\111\110",BackgroundTransparency=1,AnchorPoint=Vector2.new(0,.5);Position=UDim2.new(0,0,.5,0);Size=UDim2.new(0,50,0,50),Image="";ZIndex=3;Selectable=false;SelectionImageObject=noSelectionObject;Active=true,Parent=f.SliderFrame})local u=(Util.Create("\073\109\097\103\101\066\117\116\116\111\110"))({Name="\082\105\103\104\116\066\117\116\116\111\110";BackgroundTransparency=1,AnchorPoint=Vector2.new(1,.5);Position=UDim2.new(1,0,.5,0);Size=UDim2.new(0,50,0,50),Image="",ZIndex=3,Selectable=false,SelectionImageObject=noSelectionObject,Active=true;Parent=f.SliderFrame})local U=(Util.Create("\073\109\097\103\101\076\097\098\101\108"))({Name="\076\101\102\116\066\117\116\116\111\110",BackgroundTransparency=1,AnchorPoint=Vector2.new(.5,.5),Position=UDim2.new(.5,0,.5,0),Size=UDim2.new(0,30,0,30),Image="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\083\101\116\116\105\110\103\115\047\083\108\105\100\101\114\047\076\101\115\115\046\112\110\103";ZIndex=4,Parent=E;ImageColor3=UserInputService.TouchEnabled and ARROW_COLOR_TOUCH or ARROW_COLOR})local m=(Util.Create("\073\109\097\103\101\076\097\098\101\108"))({Name="\082\105\103\104\116\066\117\116\116\111\110",BackgroundTransparency=1;AnchorPoint=Vector2.new(.5,.5);Position=UDim2.new(.5,0,.5,0);Size=UDim2.new(0,30,0,30);Image="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\083\101\116\116\105\110\103\115\047\083\108\105\100\101\114\047\077\111\114\101\046\112\110\103",ZIndex=4;Parent=u;ImageColor3=UserInputService.TouchEnabled and ARROW_COLOR_TOUCH or ARROW_COLOR})if not UserInputService.TouchEnabled then local K,n=function(K)K.ImageColor3=ARROW_COLOR end,function(K)K.ImageColor3=ARROW_COLOR_HOVER end o(E,U,K,n)o(u,m,K,n)end f.Steps={}local s=35 if B()then s=25 end local A=1/g s=0 for K=1,g,1 do local n=(Util.Create("\073\109\097\103\101\066\117\116\116\111\110"))({Name="\083\116\101\112"..tostring(K);BackgroundColor3=SELECTED_COLOR;BackgroundTransparency=.36;BorderSizePixel=0;AutoButtonColor=false,Active=false,AnchorPoint=Vector2.new(0,.5),Position=UDim2.new((K-1)*A,I/2,.5,0);Size=UDim2.new(A,-I,.48,0);Image="",ZIndex=3,Selectable=false,ImageTransparency=.36;Parent=f.StepsContainer,SelectionImageObject=noSelectionObject})if K>V then n.BackgroundColor3=NON_SELECTED_COLOR end if K==1 or K==g then n.BackgroundTransparency=1 n.ScaleType=Enum.ScaleType.Slice n.SliceCenter=Rect.new(3,3,32,21)if K<=V then if K==1 then n.Image=SELECTED_LEFT_IMAGE else n.Image=SELECTED_RIGHT_IMAGE end else if K==1 then n.Image=NON_SELECTED_LEFT_IMAGE else n.Image=NON_SELECTED_RIGHT_IMAGE end end end f.Steps[#f.Steps+1]=n end local function F()for K=1,g,1 do f.Steps[K].BackgroundColor3=NON_SELECTED_COLOR if K==1 then f.Steps[K].Image=NON_SELECTED_LEFT_IMAGE elseif K==g then f.Steps[K].Image=NON_SELECTED_RIGHT_IMAGE end end end local function W()for K=1,g,1 do if K>V then break end f.Steps[K].BackgroundColor3=SELECTED_COLOR if K==1 then f.Steps[K].Image=SELECTED_LEFT_IMAGE elseif K==g then f.Steps[K].Image=SELECTED_RIGHT_IMAGE end end end local function p(K)for n=1,g,1 do if n==1 or n==g then f.Steps[n].ImageTransparency=K else f.Steps[n].BackgroundTransparency=K end end end local function h(K)if not D then D=0 end E.Visible=true u.Visible=true if K<=D then K=D E.Visible=false end if K>=g then K=g u.Visible=false end if V==K then return end V=K F()W()t=tick()X:Fire(V)end local function L(K)if not K then return false end return K.UserInputType==Enum.UserInputType.MouseButton1 or K.UserInputType==Enum.UserInputType.Touch or K.UserInputType==Enum.UserInputType.Gamepad1 and K.KeyCode==Enum.KeyCode.ButtonA end local function i(K,n,B)if not q then return end if K==nil then return end if not L(K)then return end if k()and not VRService.VREnabled then GuiService.SelectedCoreObject=f.SliderFrame end if not VRService.VREnabled then if B then Y=n-V else Y=0 local K=nil local n=nil K=UserInputService.InputChanged:Connect(function(K)if K.UserInputType~=Enum.UserInputType.MouseMovement then return end local n=K.Position.X for K=1,g,1 do local B=f.Steps[K].AbsolutePosition.X local D=f.Steps[K].AbsoluteSize.X if n>=B and n<=B+D then h(K)break elseif K==1 and n<B then h(0)break elseif K==g and n>=B then h(K)break end end end)n=UserInputService.InputEnded:Connect(function(B)if not L(B)then return end Y=0 n:Disconnect()K:Disconnect()end)end else Y=0 end h(n)end local function Q(K)if not q then return end if not L(K)then return end Y=0 end local function P(K,n,B)i(K,n,B)end f.ValueChanged=X.Event function f.SetValue(n,K)h(K)end function f.GetValue(K)return V end function f.SetInteractable(n,K)Y=0 q=K f.SliderFrame.Selectable=K if not q then F()else W()end end function f.SetZIndex(n,K)E.ZIndex=K u.ZIndex=K U.ZIndex=K m.ZIndex=K for n=1,#f.Steps,1 do f.Steps[n].ZIndex=K end end function f.SetMinStep(n,K)if K>=0 and K<=g then D=K end if V<=D then V=D E.Visible=false end if V>=g then V=g u.Visible=false end end E.InputBegan:Connect(function(K)i(K,V-1,true)end)E.InputEnded:Connect(function(K)Q(K)end)u.InputBegan:Connect(function(K)i(K,V+1,true)end)u.InputEnded:Connect(function(K)Q(K)end)local function M(K)if K~="\086\082\069\110\097\098\108\101\100"then return end if VRService.VREnabled then E.Selectable=q u.Selectable=q f.SliderFrame.Selectable=q for K=1,g,1 do f.Steps[K].Selectable=q f.Steps[K].Active=q end else E.Selectable=false u.Selectable=false f.SliderFrame.Selectable=q for K=1,g,1 do f.Steps[K].Selectable=false f.Steps[K].Active=false end end end VRService.Changed:Connect(M)M("\086\082\069\110\097\098\108\101\100")for K=1,g,1 do f.Steps[K].InputBegan:Connect(function(n)i(n,K)end)f.Steps[K].InputEnded:Connect(function(K)Q(K)end)end f.SliderFrame.InputBegan:Connect(function(K)if VRService.VREnabled then local K=GuiService.SelectedCoreObject if not K or not K:IsDescendantOf(f.SliderFrame.Parent)then return end end i(K,V)end)f.SliderFrame.InputEnded:Connect(function(K)if VRService.VREnabled then local K=GuiService.SelectedCoreObject if not K or not K:IsDescendantOf(f.SliderFrame.Parent)then return end end Q(K)end)local z=function()if t==nil then return end local K=tick()local n=K-t if n>=CONTROLLER_SCROLL_DELTA then h(V+Y)end end local O=true local a=-1 local Z=1 local b={[Enum.KeyCode.Thumbstick1]=true,[Enum.KeyCode.DPadLeft]=a,[Enum.KeyCode.DPadRight]=Z,[Enum.KeyCode.Left]=a;[Enum.KeyCode.Right]=Z,[Enum.KeyCode.A]=a;[Enum.KeyCode.D]=Z;[Enum.KeyCode.ButtonA]=true}UserInputService.InputBegan:Connect(function(K)if not q then return end if not O then return end if K.UserInputType~=Enum.UserInputType.Gamepad1 and K.UserInputType~=Enum.UserInputType.Keyboard then return end local n=GuiService.SelectedCoreObject if not n or not n:IsDescendantOf(f.SliderFrame.Parent)then return end if b[K.KeyCode]==a then Y=-1 h(V-1)elseif b[K.KeyCode]==Z then Y=1 h(V+1)end end)UserInputService.InputEnded:Connect(function(K)if not q then return end if K.UserInputType~=Enum.UserInputType.Gamepad1 and K.UserInputType~=Enum.UserInputType.Keyboard then return end local n=GuiService.SelectedCoreObject if not n or not n:IsDescendantOf(f.SliderFrame.Parent)then return end if b[K.KeyCode]then Y=0 end end)UserInputService.InputChanged:Connect(function(K)if not q then Y=0 return end if not O then Y=0 return end if K.UserInputType~=Enum.UserInputType.Gamepad1 then return end local n=GuiService.SelectedCoreObject if not n or not n:IsDescendantOf(f.SliderFrame.Parent)then return end if K.KeyCode~=Enum.KeyCode.Thumbstick1 then return end if K.Position.X>CONTROLLER_THUMBSTICK_DEADZONE and(K.Delta.X>0 and Y~=1)then Y=1 h(V+1)elseif K.Position.X<-CONTROLLER_THUMBSTICK_DEADZONE and(K.Delta.X<0 and Y~=-1)then Y=-1 h(V-1)elseif math.abs(K.Position.X)<CONTROLLER_THUMBSTICK_DEADZONE then Y=0 end end)local T=false GuiService.Changed:Connect(function(K)if K~="\083\101\108\101\099\116\101\100\067\111\114\101\079\098\106\101\099\116"then return end local n=GuiService.SelectedCoreObject local B=n and n:IsDescendantOf(f.SliderFrame.Parent)if B then p(0)if not T then T=true t=tick()RunService:BindToRenderStep(d,Enum.RenderPriority.Input.Value+1,z)end else p(.36)if T then T=false RunService:UnbindFromRenderStep(d)end end end)f.SliderFrame.AncestryChanged:Connect(function(K,n)O=n end)h(V)return f end local A=50 if f()then A=90 end local F={}local function W(K,B,I,S,g,V)local o=0 local t=I~="\084\101\120\116\066\111\120"if F[K]then o=F[K]end local q=nil q=(Util.Create("\073\109\097\103\101\066\117\116\116\111\110"))({Name=B.."\070\114\097\109\101",BackgroundTransparency=1,BorderSizePixel=0,Image="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\086\082\047\114\101\099\116\066\097\099\107\103\114\111\117\110\100\087\104\105\116\101\046\112\110\103",ScaleType=Enum.ScaleType.Slice;SliceCenter=Rect.new(2,2,18,18);ImageTransparency=1,Active=false;AutoButtonColor=false;Size=UDim2.new(1,0,0,A),Position=UDim2.new(0,0,0,o),ZIndex=2,Selectable=false;SelectionImageObject=noSelectionObject;Parent=K.Page})q.ImageColor3=q.BackgroundColor3 if q and V then q.Position=UDim2.new(q.Position.X.Scale,q.Position.X.Offset,q.Position.Y.Scale,q.Position.Y.Offset+V)end local d=nil d=(Util.Create("\084\101\120\116\076\097\098\101\108"))({Name=B.."\076\097\098\101\108",Text=B,Font=Enum.Font.SourceSansBold;TextSize=16;TextColor3=Color3.fromRGB(255,255,255);TextXAlignment=Enum.TextXAlignment.Left;BackgroundTransparency=1;Size=UDim2.new(0,200,1,0);Position=UDim2.new(0,10,0,0);ZIndex=2,Parent=q})local X=Instance.new("\085\073\084\101\120\116\083\105\122\101\067\111\110\115\116\114\097\105\110\116")if FFlagUseNotificationsLocalization then d.Size=UDim2.new(.35,0,1,0)d.TextScaled=true d.TextWrapped=true X.Parent=d X.MaxTextSize=16 end if not t then d.Text=""end local function E(K,n)if n then d.TextSize=16 else d.TextSize=f()and 36 or 24 end X.MaxTextSize=d.TextSize end E(n(),D())Y(q,E)local m=nil local W=nil if I=="\083\108\105\100\101\114"then W=s(S,g)W.SliderFrame.Parent=q m=W.SliderFrame elseif I=="\083\101\108\101\099\116\111\114"then W=U(S,g)W.SelectorFrame.Parent=q m=W.SelectorFrame elseif I=="\068\114\111\112\068\111\119\110"then W=u(S,g,K.HubRef)W.DropDownFrame.Parent=q m=W.DropDownFrame elseif I=="\084\101\120\116\066\111\120"then local n=false local D=false local f=(Util.Create("\073\109\097\103\101\076\097\098\101\108"))({Image="",BackgroundTransparency=1})W={}W.HubRef=nil local I=(Util.Create("\084\101\120\116\066\111\120"))({AnchorPoint=Vector2.new(1,.5),Size=UDim2.new(.6,0,1,0),Position=UDim2.new(1,0,.5,0),Text=B;TextColor3=Color3.fromRGB(49,49,49),BackgroundTransparency=.5,BorderSizePixel=0,TextYAlignment=Enum.TextYAlignment.Top;TextXAlignment=Enum.TextXAlignment.Left,TextWrapped=true,Font=Enum.Font.SourceSans;TextSize=24;ZIndex=2;SelectionImageObject=f,ClearTextOnFocus=false,Parent=q})m=I I.Focused:Connect(function()if k()then GuiService.SelectedCoreObject=I end if I.Text==B then I.Text=""end end)I.FocusLost:Connect(function(K,n)D=false end)if V then I.Position=UDim2.new(I.Position.X.Scale,I.Position.X.Offset,I.Position.Y.Scale,I.Position.Y.Offset+V)end m.SelectionGained:Connect(function()if k()then I.BackgroundTransparency=.1 if W.HubRef then W.HubRef:ScrollToFrame(m)end end end)m.SelectionLost:Connect(function()if k()then I.BackgroundTransparency=.5 end end)local S=function()local B=CoreGui.RobloxGui:FindFirstChild("\068\114\111\112\068\111\119\110\070\117\108\108\115\099\114\101\101\110\070\114\097\109\101")if B and B.Visible then return end local D=m if D and(D.Visible and(D.ZIndex>1 and(k()and K.Active)))then GuiService.SelectedCoreObject=D n=true end end local function g(K)if K.UserInputState==Enum.UserInputState.Begin then if K.KeyCode==Enum.KeyCode.Return then if GuiService.SelectedCoreObject==m then D=true I:CaptureFocus()end end end end I.MouseEnter:Connect(S)UserInputService.InputBegan:Connect(g)elseif I=="\084\101\120\116\069\110\116\114\121"then local n=false local D=false local f=(Util.Create("\073\109\097\103\101\076\097\098\101\108"))({Image="",BackgroundTransparency=1})W={}W.HubRef=nil local I=(Util.Create("\084\101\120\116\066\111\120"))({AnchorPoint=Vector2.new(1,.5),Size=UDim2.new(.4,-10,0,40),Position=UDim2.new(1,0,.5,0),Text=B,TextColor3=Color3.fromRGB(178,178,178),BackgroundTransparency=1.0,BorderSizePixel=0;TextYAlignment=Enum.TextYAlignment.Center;TextXAlignment=Enum.TextXAlignment.Center;TextWrapped=false,Font=Enum.Font.SourceSans;TextSize=24,ZIndex=2;SelectionImageObject=f;ClearTextOnFocus=false,Parent=q})m=I I.Focused:Connect(function()if k()then GuiService.SelectedCoreObject=I end if I.Text==B then I.Text=""end end)I.FocusLost:Connect(function(K,n)D=false end)if V then I.Position=UDim2.new(I.Position.X.Scale,I.Position.X.Offset,I.Position.Y.Scale,I.Position.Y.Offset+V)end m.SelectionGained:Connect(function()if k()then I.BackgroundTransparency=.8 if W.HubRef then W.HubRef:ScrollToFrame(m)end end end)m.SelectionLost:Connect(function()if k()then I.BackgroundTransparency=1.0 end end)local S=function()local B=CoreGui.RobloxGui:FindFirstChild("\068\114\111\112\068\111\119\110\070\117\108\108\115\099\114\101\101\110\070\114\097\109\101")if B and B.Visible then return end local D=m if D and(D.Visible and(D.ZIndex>1 and(k()and K.Active)))then GuiService.SelectedCoreObject=D n=true end end local function g(K)if K.UserInputState==Enum.UserInputState.Begin then if K.KeyCode==Enum.KeyCode.Return then if GuiService.SelectedCoreObject==m then D=true I:CaptureFocus()end end end end q.MouseEnter:Connect(S)function W.SetZIndex(n,K)I.ZIndex=K end function W.SetInteractable(n,K)I.Selectable=K if not K then I.TextColor3=Color3.fromRGB(49,49,49)I.ZIndex=1 else I.TextColor3=Color3.fromRGB(178,178,178)I.ZIndex=2 end end function W.SetValue(n,K)I.Text=K end local o=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")o.Name="\086\097\108\117\101\067\104\097\110\103\101\100"I.FocusLost:Connect(function()o:Fire(I.Text)end)W.ValueChanged=o.Event UserInputService.InputBegan:Connect(g)end W.Name=B.."\086\097\108\117\101\067\104\097\110\103\101\114"o=o+A if V then o=o+V end F[K]=o if t then local n=function()local n=CoreGui.RobloxGui:FindFirstChild("\068\114\111\112\068\111\119\110\070\117\108\108\115\099\114\101\101\110\070\114\097\109\101")if n and n.Visible then return end local B=W.SliderFrame if not B then B=W.SliderFrame end if not B then B=W.DropDownFrame end if not B then B=W.SelectorFrame end if B and(B.Visible and(B.ZIndex>1 and(k()and K.Active)))then GuiService.SelectedCoreObject=B end end q.MouseEnter:Connect(n)local function B(K)if K=="\086\082\069\110\097\098\108\101\100"then if VRService.VREnabled then q.Selectable=true q.Active=true m.Active=true GuiService.Changed:Connect(function(K)if K=="\083\101\108\101\099\116\101\100\067\111\114\101\079\098\106\101\099\116"then local K=GuiService.SelectedCoreObject if K and(K==q or K:IsDescendantOf(q))then q.ImageTransparency=.5 q.BackgroundTransparency=1 else q.ImageTransparency=1 q.BackgroundTransparency=1 end end end)else q.Selectable=false q.Active=false end end end VRService.Changed:Connect(B)B("\086\082\069\110\097\098\108\101\100")m.SelectionGained:Connect(function()if k()then if VRService.VREnabled then q.ImageTransparency=.5 q.BackgroundTransparency=1 else q.ImageTransparency=1 q.BackgroundTransparency=.5 end if W.HubRef then W.HubRef:ScrollToFrame(q)end end end)m.SelectionLost:Connect(function()if k()then q.ImageTransparency=1 q.BackgroundTransparency=1 end end)end K:AddRow(q,d,W,V,false)W.Selection=m return q,d,W end local function p(K,n,B,D)local k=0 if F[K]then k=F[K]end local I=(Util.Create("\073\109\097\103\101\066\117\116\116\111\110"))({Name=n.."\070\114\097\109\101";BackgroundTransparency=1;BorderSizePixel=0,Image="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\086\082\047\114\101\099\116\066\097\099\107\103\114\111\117\110\100\087\104\105\116\101\046\112\110\103";ScaleType=Enum.ScaleType.Slice;SliceCenter=Rect.new(10,10,10,10),ImageTransparency=1,Active=false,AutoButtonColor=false,Size=UDim2.new(1,0,0,A);Position=UDim2.new(0,0,0,k),ZIndex=2,Selectable=false;SelectionImageObject=noSelectionObject,Parent=K.Page})I.ImageColor3=I.BackgroundColor3 I.SelectionGained:Connect(function()I.BackgroundTransparency=.5 end)I.SelectionLost:Connect(function()I.BackgroundTransparency=1 end)local S=(Util.Create("\084\101\120\116\076\097\098\101\108"))({Name=n.."\076\097\098\101\108",Text=n;Font=Enum.Font.SourceSansBold;TextSize=16,TextColor3=Color3.fromRGB(255,255,255),TextXAlignment=Enum.TextXAlignment.Left;BackgroundTransparency=1,Size=UDim2.new(0,200,1,0);Position=UDim2.new(0,10,0,0);ZIndex=2,Parent=I})local function g(K,n)if n then S.TextSize=16 else S.TextSize=f()and 36 or 24 end end Y(I,g)if D then I.Position=UDim2.new(I.Position.X.Scale,I.Position.X.Offset,I.Position.Y.Scale,I.Position.Y.Offset+D)end k=k+A if D then k=k+D end F[K]=k local V=function()if I.Visible then GuiService.SelectedCoreObject=I end end I.MouseEnter:Connect(V)B.SelectionImageObject=noSelectionObject B.SelectionGained:Connect(function()if VRService.VREnabled then I.ImageTransparency=.5 I.BackgroundTransparency=1 else I.ImageTransparency=1 I.BackgroundTransparency=.5 end end)B.SelectionLost:Connect(function()I.ImageTransparency=1 I.BackgroundTransparency=1 end)B.Parent=I K:AddRow(I,S,B,D,true)return I end


local function CreateSignal()
	local sig = {}

	local mSignaler = Instance.new('BindableEvent')

	local mArgData = nil
	local mArgDataCount = nil

	function sig:fire(...)
		mArgData = {...}
		mArgDataCount = select('#', ...)
		mSignaler:Fire()
	end

	function sig:connect(f)
		if not f then error("connect(nil)", 2) end
		return mSignaler.Event:Connect(function()
			f(unpack(mArgData, 1, mArgDataCount))
		end)
	end

	function sig:wait()
		mSignaler.Event:wait()
		if not mArgData then
			error("Missing arg data, likely due to :TweenSize/Position corrupting threadrefs.")
		end
		return unpack(mArgData, 1, mArgDataCount)
	end

	return sig
end

local function getViewportSize()
	while not workspace.CurrentCamera do
		workspace.Changed:wait()
	end

	-- ViewportSize is initally set to 1, 1 in Camera.cpp constructor.
	-- Also check against 0, 0 incase this is changed in the future.
	while workspace.CurrentCamera.ViewportSize == Vector2.new(0,0) or
		workspace.CurrentCamera.ViewportSize == Vector2.new(1,1) do
		workspace.CurrentCamera.Changed:wait()
	end

	return workspace.CurrentCamera.ViewportSize
end

local function isSmallTouchScreen()
	local viewportSize = getViewportSize()
	return UserInputService.TouchEnabled and (viewportSize.Y < 500 or viewportSize.X < 700)
end

local function isPortrait()
	local viewport = getViewportSize()
	return viewport.Y > viewport.X
end

local function isTenFootInterface()
	return tenFootInterfaceEnabled
end

local function usesSelectedObject()
	--VR does not use selected objects (in the same way as gamepad)
	if VRService.VREnabled then return false end
	--Touch does not use selected objects unless there's also a gamepad
	if UserInputService.TouchEnabled and not UserInputService.GamepadEnabled then return false end
	--PC with gamepad, console... does use selected objects
	return true
end

local function isPosOverGui(pos, gui, debug) -- does not account for rotation
	local ax, ay = gui.AbsolutePosition.x, gui.AbsolutePosition.y
	local sx, sy = gui.AbsoluteSize.x, gui.AbsoluteSize.y
	local bx, by = ax+sx, ay+sy

	return pos.x > ax and pos.x < bx and pos.y > ay and pos.y < by
end

local function isPosOverGuiWithClipping(pos, gui) -- isPosOverGui, accounts for clipping and visibility, does not account for rotation
	if not isPosOverGui(pos, gui) then
		return false
	end

	local clipping = false
	local check = gui
	while true do
		if check == nil or (not check:IsA'GuiObject' and not check:IsA'LayerCollector') then
			clipping = true
			if check and check:IsA'CoreGui' then
				clipping = false
			end
			break
		end

		if check:IsA'GuiObject' and not check.Visible then
			clipping = true
			break
		end
		if check:IsA'LayerCollector' or check.ClipsDescendants then
			if not isPosOverGui(pos, check) then
				clipping = true
				break
			end
		end

		check = check.Parent
	end

	return not clipping
end

local function areGuisIntersecting(a, b) -- does not account for rotation
	local aax, aay = a.AbsolutePosition.x, a.AbsolutePosition.y
	local asx, asy = a.AbsoluteSize.x, a.AbsoluteSize.y
	local abx, aby = aax+asx, aay+asy
	local bax, bay = b.AbsolutePosition.x, b.AbsolutePosition.y
	local bsx, bsy = b.AbsoluteSize.x, b.AbsoluteSize.y
	local bbx, bby = bax+bsx, bay+bsy

	local intersectingX = aax < bbx and abx > bax
	local intersectingY = aay < bby and aby > bay
	local intersecting = intersectingX and intersectingY

	return intersecting
end

local function isGuiVisible(gui, debug) -- true if any part of the gui is visible on the screen, considers clipping, does not account for rotation
	local clipping = false
	local check = gui
	while true do
		if check == nil or not check:IsA'GuiObject' and not check:IsA'LayerCollector' then
			clipping = true
			if check and check:IsA'CoreGui' then
				clipping = false
			end
			break
		end

		if check:IsA'GuiObject' and not check.Visible then
			clipping = true
			break
		end
		if check:IsA'LayerCollector' or check.ClipsDescendants then
			if not areGuisIntersecting(check, gui) then
				clipping = true
				break
			end
		end

		check = check.Parent
	end

	return not clipping
end

local function addHoverState(button, instance, onNormalButtonState, onHoverButtonState)
	local function onNormalButtonStateCallback()
        if button.Active then
            onNormalButtonState(instance)
        end
	end
	local function onHoverButtonStateCallback()
        if button.Active then
            onHoverButtonState(instance)
        end
	end

	button.MouseEnter:Connect(onHoverButtonStateCallback)
	button.SelectionGained:Connect(onHoverButtonStateCallback)
	button.MouseLeave:Connect(onNormalButtonStateCallback)
	button.SelectionLost:Connect(onNormalButtonStateCallback)

	onNormalButtonState(instance)
end

local function addOnResizedCallback(key, callback)
	onResizedCallbacks[key] = callback
	callback(getViewportSize(), isPortrait())
end

local gamepadSet = {
	[Enum.UserInputType.Gamepad1] = true;
	[Enum.UserInputType.Gamepad2] = true;
	[Enum.UserInputType.Gamepad3] = true;
	[Enum.UserInputType.Gamepad4] = true;
	[Enum.UserInputType.Gamepad5] = true;
	[Enum.UserInputType.Gamepad6] = true;
	[Enum.UserInputType.Gamepad7] = true;
	[Enum.UserInputType.Gamepad8] = true;
}

local function MakeDefaultButton(name, size, clickFunc, pageRef, hubRef)
	local SelectionOverrideObject = Util.Create'ImageLabel'
	{
		Image = "",
		BackgroundTransparency = 1,
	};

	local button = Util.Create'ImageButton'
	{
		Name = name .. "Button",
		Image = "rbxasset://textures/ui/Settings/MenuBarAssets/MenuButton.png",
		ScaleType = Enum.ScaleType.Slice,
		SliceCenter = Rect.new(8,6,46,44),
		AutoButtonColor = false,
		BackgroundTransparency = 1,
		Size = size,
		ZIndex = 2,
		SelectionImageObject = SelectionOverrideObject
	};

	local enabled = Util.Create'BoolValue'
	{
		Name = 'Enabled',
		Parent = button,
		Value = true
	}

	if clickFunc then
		button.MouseButton1Click:Connect(function()
			clickFunc(gamepadSet[UserInputService:GetLastInputType()] or false)
		end)
	end

	local function isPointerInput(inputObject)
		return inputObject.UserInputType == Enum.UserInputType.MouseMovement or inputObject.UserInputType == Enum.UserInputType.Touch
	end

	local rowRef = nil
	local function setRowRef(ref)
		rowRef = ref
	end

	local function selectButton()
		local hub = hubRef
		if hub == nil then
			if pageRef then
				hub = pageRef.HubRef
			end
		end

		if (hub and hub.Active) or hub == nil then
			button.Image = "rbxasset://textures/ui/Settings/MenuBarAssets/MenuButtonSelected.png"

			local scrollTo = button
			if rowRef then
				scrollTo = rowRef
			end
			if hub then
				hub:ScrollToFrame(scrollTo)
			end
		end
	end

	local function deselectButton()
		button.Image = "rbxasset://textures/ui/Settings/MenuBarAssets/MenuButton.png"
	end

	button.InputBegan:Connect(function(inputObject)
		if button.Selectable and isPointerInput(inputObject) then
			selectButton()
		end
	end)
	button.InputEnded:Connect(function(inputObject)
		if button.Selectable and GuiService.SelectedCoreObject ~= button and isPointerInput(inputObject) then
			deselectButton()
		end
	end)


	button.SelectionGained:Connect(function()
		selectButton()
	end)
	button.SelectionLost:Connect(function()
		deselectButton()
	end)

	local guiServiceCon = GuiService.Changed:Connect(function(prop)
		if prop ~= "SelectedCoreObject" then return end
		if not usesSelectedObject() then return end

		if GuiService.SelectedCoreObject == nil or GuiService.SelectedCoreObject ~= button then
			deselectButton()
			return
		end

		if button.Selectable then
			selectButton()
		end
	end)

	return button, setRowRef
end

local function MakeButton(name, text, size, clickFunc, pageRef, hubRef)
	local button, setRowRef = MakeDefaultButton(name, size, clickFunc, pageRef, hubRef)

	local textLabel = Util.Create'TextLabel'
	{
		Name = name .. "TextLabel",
		BackgroundTransparency = 1,
		BorderSizePixel = 0,
		Size = UDim2.new(1, 0, 1, -8),
		Position = UDim2.new(0,0,0,0),
		TextColor3 = Color3.fromRGB(255,255,255),
		TextYAlignment = Enum.TextYAlignment.Center,
		Font = Enum.Font.SourceSansBold,
		TextSize = 24,
		Text = text,
		TextScaled = true,
		TextWrapped = true,
		ZIndex = 2,
		Parent = button
	};
	local constraint = Instance.new("UITextSizeConstraint",textLabel)

	if isSmallTouchScreen() then
		textLabel.TextSize = 18
	elseif isTenFootInterface() then
		textLabel.TextSize = 36
	end
	constraint.MaxTextSize = textLabel.TextSize

	return button, textLabel, setRowRef
end

local function MakeImageButton(name, image, size, imageSize, clickFunc, pageRef, hubRef)
	local button, setRowRef = MakeDefaultButton(name, size, clickFunc, pageRef, hubRef)

	local imageLabel = Util.Create'ImageLabel'
	{
		Name = name .. "ImageLabel",
		BackgroundTransparency = 1,
		BorderSizePixel = 0,
		Size = imageSize,
		Position = UDim2.new(0.5, 0, 0.5, 0),
		AnchorPoint = Vector2.new(0.5, 0.5),
		Image = image,
		ZIndex = 2,
		Parent = button
	};

	return button, imageLabel, setRowRef
end

local function AddButtonRow(pageToAddTo, name, text, size, clickFunc, hubRef)
	local button, textLabel, setRowRef = MakeButton(name, text, size, clickFunc, pageToAddTo, hubRef)
	local row = Util.Create'Frame'
	{
		Name = name .. "Row",
		BackgroundTransparency = 1,
		Size = UDim2.new(1, 0, size.Y.Scale, size.Y.Offset),
		Parent = pageToAddTo.Page
	}
	button.Parent = row
	button.AnchorPoint = Vector2.new(1, 0)
	button.Position = UDim2.new(1, -20, 0, 0)
	return row, button, textLabel, setRowRef
end

local function CreateDropDown(dropDownStringTable, startPosition, settingsHub)
	-------------------- CONSTANTS ------------------------
	local DEFAULT_DROPDOWN_TEXT = "Choose One"
	local SCROLLING_FRAME_PIXEL_OFFSET = 25
	local SELECTION_TEXT_COLOR_NORMAL = Color3.fromRGB(178,178,178)
	local SELECTION_TEXT_COLOR_NORMAL_VR = Color3.fromRGB(229,229,229)
	local SELECTION_TEXT_COLOR_HIGHLIGHTED = Color3.fromRGB(255,255,255)

	-------------------- VARIABLES ------------------------
	local lastSelectedCoreObject = nil

	-------------------- SETUP ------------------------
	local this = {}
	this.CurrentIndex = nil

	local indexChangedEvent = Instance.new("BindableEvent")
	indexChangedEvent.Name = "IndexChanged"

	if type(dropDownStringTable) ~= "table" then
		error("CreateDropDown dropDownStringTable (first arg) is not a table", 2)
		return this
	end

	local indexChangedEvent = Instance.new("BindableEvent")
	indexChangedEvent.Name = "IndexChanged"

	local interactable = true
	local guid = HttpService:GenerateGUID(false)
	local dropDownButtonEnabled
	local lastStringTable = dropDownStringTable

	----------------- GUI SETUP ------------------------
	local DropDownFullscreenFrame = Util.Create'ImageButton'
	{
		Name = "DropDownFullscreenFrame",
		BackgroundTransparency = DROPDOWN_BG_TRANSPARENCY,
		BorderSizePixel = 0,
		Size = UDim2.new(1, 0, 1, 0),
		BackgroundColor3 = Color3.fromRGB(0,0,0),
		ZIndex = 10,
		Active = true,
		Visible = false,
		Selectable = false,
		AutoButtonColor = false,
		Parent = CoreGui.RobloxGui
	};

	local function onVREnabled(prop)
		if prop ~= "VREnabled" then
			return
		end
		if VRService.VREnabled then
			local Panel3D = require(CoreGui.RobloxGui.Modules.VR.Panel3D)
			DropDownFullscreenFrame.Parent = Panel3D.Get("SettingsMenu"):GetGUI()
			DropDownFullscreenFrame.BackgroundTransparency = 1
		else
			DropDownFullscreenFrame.Parent = CoreGui.RobloxGui
			DropDownFullscreenFrame.BackgroundTransparency = DROPDOWN_BG_TRANSPARENCY
		end

		--Force the gui to update, but only if onVREnabled is fired later on
		if this.UpdateDropDownList then
			this:UpdateDropDownList(lastStringTable)
		end
	end
	VRService.Changed:Connect(onVREnabled)
	onVREnabled("VREnabled")

	local DropDownSelectionFrame = Util.Create'ImageLabel'
	{
		Name = "DropDownSelectionFrame",
		Image = "rbxasset://textures/ui/Settings/MenuBarAssets/MenuButton.png",
		ScaleType = Enum.ScaleType.Slice,
		SliceCenter = Rect.new(8,6,46,44),
		BackgroundTransparency = 1,
		Size = UDim2.new(0.6, 0, 0.9, 0),
		Position = UDim2.new(0.5, 0, 0.5, 0),
		AnchorPoint = Vector2.new(0.5, 0.5),
		ZIndex = 10,
		Parent = DropDownFullscreenFrame
	};

	local DropDownScrollingFrame = Util.Create'ScrollingFrame'
	{
		Name = "DropDownScrollingFrame",
		BackgroundTransparency = 1,
		BorderSizePixel = 0,
		Size = UDim2.new(1, -20, 1, -SCROLLING_FRAME_PIXEL_OFFSET),
		Position = UDim2.new(0, 10, 0, 10),
		ZIndex = 10,
		Parent = DropDownSelectionFrame
	};

	local guiServiceChangeCon = nil
	local active = false
	local hideDropDownSelection = function(name, inputState)
		if name ~= nil and inputState ~= Enum.UserInputState.Begin then return end
		this.DropDownFrame.Selectable = interactable

		--Make sure to set the hub to Active again so selecting the
		--dropdown button will highlight it
		settingsHub:SetActive(true)

		if DropDownFullscreenFrame.Visible and usesSelectedObject() then
			GuiService.SelectedCoreObject = lastSelectedCoreObject
		end
		DropDownFullscreenFrame.Visible = false
		if guiServiceChangeCon then guiServiceChangeCon:Disconnect() end
		ContextActionService:UnbindAction(guid .. "Action")
		ContextActionService:UnbindAction(guid .. "FreezeAction")

		dropDownButtonEnabled.Value = interactable
		active = false

		if VRService.VREnabled then
			local Panel3D = require(CoreGui.RobloxGui.Modules.VR.Panel3D)
			Panel3D.Get("SettingsMenu"):SetSubpanelDepth(DropDownFullscreenFrame, 0)
		end
	end
	local noOpFunc = function() end

	local DropDownFrameClicked = function()
		if not interactable then return end

		this.DropDownFrame.Selectable = false
		active = true

		DropDownFullscreenFrame.Visible = true
		if VRService.VREnabled then
			local Panel3D = require(CoreGui.RobloxGui.Modules.VR.Panel3D)
			Panel3D.Get("SettingsMenu"):SetSubpanelDepth(DropDownFullscreenFrame, 0.5)
		end

		lastSelectedCoreObject = this.DropDownFrame
		if this.CurrentIndex and this.CurrentIndex > 0 then
			GuiService.SelectedCoreObject = this.Selections[this.CurrentIndex]
		end

		guiServiceChangeCon = GuiService:GetPropertyChangedSignal("SelectedCoreObject"):Connect(function()
			for i = 1, #this.Selections do
				if GuiService.SelectedCoreObject == this.Selections[i] then
					this.Selections[i].TextColor3 = SELECTION_TEXT_COLOR_HIGHLIGHTED
				else
					this.Selections[i].TextColor3 = VRService.VREnabled and SELECTION_TEXT_COLOR_NORMAL_VR or SELECTION_TEXT_COLOR_NORMAL
				end
			end
		end)

		ContextActionService:BindActionAtPriority(guid .. "FreezeAction", noOpFunc, false, Enum.ContextActionPriority.High.Value, Enum.UserInputType.Keyboard, Enum.UserInputType.Gamepad1)
		ContextActionService:BindActionAtPriority(guid .. "Action", hideDropDownSelection, false, Enum.ContextActionPriority.High.Value, Enum.KeyCode.ButtonB, Enum.KeyCode.Escape)

		settingsHub:SetActive(false)

		dropDownButtonEnabled.Value = false
	end

	local dropDownFrameSize = UDim2.new(0.6, 0, 0, 50)
	this.DropDownFrame = MakeButton("DropDownFrame", DEFAULT_DROPDOWN_TEXT, dropDownFrameSize, DropDownFrameClicked, nil, settingsHub)
	this.DropDownFrame.Position = UDim2.new(1, 0, 0.5, 0)
	this.DropDownFrame.AnchorPoint = Vector2.new(1, 0.5)

	dropDownButtonEnabled = this.DropDownFrame.Enabled
	local selectedTextLabel = this.DropDownFrame.DropDownFrameTextLabel
	selectedTextLabel.Position = UDim2.new(0, 15, 0, 0)
	selectedTextLabel.Size = UDim2.new(1, -50, 1, -8)
	selectedTextLabel.ClipsDescendants = true
	selectedTextLabel.TextXAlignment = Enum.TextXAlignment.Left
	local dropDownImage = Util.Create'ImageLabel'
	{
		Name = "DropDownImage",
		Image = "rbxasset://textures/ui/Settings/DropDown/DropDown.png",
		BackgroundTransparency = 1,
		AnchorPoint = Vector2.new(1, 0.5),
		Size = UDim2.new(0,15,0,10),
		Position = UDim2.new(1,-12,0.5,0),
		ZIndex = 2,
		Parent = this.DropDownFrame
	};
	this.DropDownImage = dropDownImage


	---------------------- FUNCTIONS -----------------------------------
	local function setSelection(index)
		local shouldFireChanged = false
		for i, selectionLabel in pairs(this.Selections) do
			if i == index then
				selectedTextLabel.Text = selectionLabel.Text
				this.CurrentIndex = i

				shouldFireChanged = true
			end
		end

		if shouldFireChanged then
			indexChangedEvent:Fire(index)
		end
	end

	local function setSelectionByValue(value)
		local shouldFireChanged = false
		for i, selectionLabel in pairs(this.Selections) do
			if selectionLabel.Text == value then
				selectedTextLabel.Text = selectionLabel.Text
				this.CurrentIndex = i

				shouldFireChanged = true
			end
		end

		if shouldFireChanged then
			indexChangedEvent:Fire(this.CurrentIndex)
		end
		return shouldFireChanged
	end

	local enterIsDown = false
	local function processInput(input)
		if input.UserInputState == Enum.UserInputState.Begin then
			if input.KeyCode == Enum.KeyCode.Return then
				if GuiService.SelectedCoreObject == this.DropDownFrame or this.SelectionInfo and this.SelectionInfo[GuiService.SelectedCoreObject] then
					enterIsDown = true
				end
			end
		elseif input.UserInputState == Enum.UserInputState.End then
			if input.KeyCode == Enum.KeyCode.Return and enterIsDown then
				enterIsDown = false
				if GuiService.SelectedCoreObject == this.DropDownFrame then
					DropDownFrameClicked()
				elseif this.SelectionInfo and this.SelectionInfo[GuiService.SelectedCoreObject] then
					local info = this.SelectionInfo[GuiService.SelectedCoreObject]
					info.Clicked()
				end
			end
		end
	end

	local function setIsFaded(isFaded)
		if isFaded then
			this.DropDownFrame.DropDownFrameTextLabel.TextTransparency = 0.5
			this.DropDownFrame.ImageTransparency = 0.5
			this.DropDownImage.ImageTransparency = 0.5
		else
			this.DropDownFrame.DropDownFrameTextLabel.TextTransparency = 0
			this.DropDownFrame.ImageTransparency = 0
			this.DropDownImage.ImageTransparency = 0
		end
	end


	--------------------- PUBLIC FACING FUNCTIONS -----------------------
	this.IndexChanged = indexChangedEvent.Event

	function this:SetSelectionIndex(newIndex)
		setSelection(newIndex)
	end

	function this:SetSelectionByValue(value)
		return setSelectionByValue(value)
	end

	function this:ResetSelectionIndex()
		this.CurrentIndex = nil
		selectedTextLabel.Text = DEFAULT_DROPDOWN_TEXT
		hideDropDownSelection()
	end

	function this:GetSelectedIndex()
		return this.CurrentIndex
	end

	function this:SetZIndex(newZIndex)
		this.DropDownFrame.ZIndex = newZIndex
		dropDownImage.ZIndex = newZIndex
		selectedTextLabel.ZIndex = newZIndex
	end

	function this:SetInteractable(value)
		interactable = value
		this.DropDownFrame.Selectable = interactable

		if not interactable then
			hideDropDownSelection()
			setIsFaded(VRService.VREnabled)
			if not VRService.VREnabled then
				this:SetZIndex(1)
			end
		else
			setIsFaded(false)
			if not VRService.VREnabled then
				this:SetZIndex(2)
			end
		end

		dropDownButtonEnabled.Value = value and not active
	end


	function this:UpdateDropDownList(dropDownStringTable)
		lastStringTable = dropDownStringTable

		if this.Selections then
			for i = 1, #this.Selections do
				this.Selections[i]:Destroy()
			end
		end

		this.Selections = {}
		this.SelectionInfo = {}

		local vrEnabled = VRService.VREnabled
		local font = vrEnabled and Enum.Font.SourceSansBold or Enum.Font.SourceSans
		local textSize = vrEnabled and 36 or 24

		local itemHeight = vrEnabled and 70 or 50
		local itemSpacing = itemHeight + 1

		local dropDownWidth = vrEnabled and 600 or 400

		for i,v in pairs(dropDownStringTable) do
			local SelectionOverrideObject =	Util.Create'Frame'
			{
				BackgroundTransparency = 0.7,
				BorderSizePixel = 0,
				Size = UDim2.new(1, 0, 1, 0)
			};

			local nextSelection = Util.Create'TextButton'
			{
				Name = "Selection" .. tostring(i),
				BackgroundTransparency = 1,
				BorderSizePixel = 0,
				AutoButtonColor = false,
				Size = UDim2.new(1, -28, 0, itemHeight),
				Position = UDim2.new(0,14,0, (i - 1) * itemSpacing),
				TextColor3 = VRService.VREnabled and SELECTION_TEXT_COLOR_NORMAL_VR or SELECTION_TEXT_COLOR_NORMAL,
				Font = font,
				TextSize = textSize,
				Text = v,
				ZIndex = 10,
				SelectionImageObject = SelectionOverrideObject,
				Parent = DropDownScrollingFrame
			};

			if i == startPosition then
				this.CurrentIndex = i
				selectedTextLabel.Text = v
				nextSelection.TextColor3 = SELECTION_TEXT_COLOR_HIGHLIGHTED
			elseif not startPosition and i == 1 then
				nextSelection.TextColor3 = SELECTION_TEXT_COLOR_HIGHLIGHTED
			end

			local clicked = function()
				selectedTextLabel.Text = nextSelection.Text
				hideDropDownSelection()
				this.CurrentIndex = i
				indexChangedEvent:Fire(i)
			end

			nextSelection.MouseButton1Click:Connect(clicked)

			nextSelection.MouseEnter:Connect(function()
				if usesSelectedObject() then
					GuiService.SelectedCoreObject = nextSelection
				end
			end)

			this.Selections[i] = nextSelection
			this.SelectionInfo[nextSelection] = {Clicked = clicked}
		end

		GuiService:RemoveSelectionGroup(guid)
		GuiService:AddSelectionTuple(guid, unpack(this.Selections))

		DropDownScrollingFrame.CanvasSize = UDim2.new(1,-20,0,#dropDownStringTable * itemSpacing)

		local function updateDropDownSize()
			if DropDownScrollingFrame.CanvasSize.Y.Offset < (DropDownFullscreenFrame.AbsoluteSize.Y - 10) then
				DropDownSelectionFrame.Size = UDim2.new(0, dropDownWidth,
														0,DropDownScrollingFrame.CanvasSize.Y.Offset + SCROLLING_FRAME_PIXEL_OFFSET)
			else
				DropDownSelectionFrame.Size = UDim2.new(0, dropDownWidth, 0.9, 0)
			end
		end

		DropDownFullscreenFrame.Changed:Connect(function(prop)
			if prop ~= "AbsoluteSize" then return end
			updateDropDownSize()
		end)

		updateDropDownSize()
	end

	----------------------- CONNECTIONS/SETUP --------------------------------
	this:UpdateDropDownList(dropDownStringTable)

	DropDownFullscreenFrame.MouseButton1Click:Connect(hideDropDownSelection)

	settingsHub.PoppedMenu:Connect(function(poppedMenu)
		if poppedMenu == DropDownFullscreenFrame then
			hideDropDownSelection()
		end
	end)

	return this
end


local function CreateSelector(selectionStringTable, startPosition)

	-------------------- VARIABLES ------------------------
	local lastInputDirection = 0
	local TweenTime = 0.15

	-------------------- SETUP ------------------------
	local this = {}
	this.HubRef = nil

	if type(selectionStringTable) ~= "table" then
		error("CreateSelector selectionStringTable (first arg) is not a table", 2)
		return this
	end

	local indexChangedEvent = Instance.new("BindableEvent")
	indexChangedEvent.Name = "IndexChanged"

	local interactable = true

	this.CurrentIndex = 0

	----------------- GUI SETUP ------------------------
	this.SelectorFrame = Util.Create'ImageButton'
	{
		Name = "Selector",
		Image = "",
		AutoButtonColor = false,
		NextSelectionLeft = this.SelectorFrame,
		NextSelectionRight = this.SelectorFrame,
		BackgroundTransparency = 1,
		Size = UDim2.new(0.6,0,0,50),
		Position = UDim2.new(1, 0, 0.5, 0),
		AnchorPoint = Vector2.new(1, 0.5),
		ZIndex = 2,
		SelectionImageObject = noSelectionObject
	};

	local leftButton = Util.Create'ImageButton'
	{
		Name = "LeftButton",
		BackgroundTransparency = 1,
		AnchorPoint = Vector2.new(0, 0.5),
		Position = UDim2.new(0,0,0.5,0),
		Size =  UDim2.new(0,50,0,50),
		Image =  "",
		ZIndex = 3,
		Selectable = false,
		SelectionImageObject = noSelectionObject,
		Parent = this.SelectorFrame
	};
	local rightButton = Util.Create'ImageButton'
	{
		Name = "RightButton",
		BackgroundTransparency = 1,
		AnchorPoint = Vector2.new(1, 0.5),
		Position = UDim2.new(1,0,0.5,0),
		Size =  UDim2.new(0,50,0,50),
		Image =  "",
		ZIndex = 3,
		Selectable = false,
		SelectionImageObject = noSelectionObject,
		Parent = this.SelectorFrame
	};

	local leftButtonImage = Util.Create'ImageLabel'
	{
		Name = "LeftButton",
		BackgroundTransparency = 1,
		AnchorPoint = Vector2.new(0.5, 0.5),
		Position = UDim2.new(0.5,0,0.5,0),
		Size =  UDim2.new(0,18,0,30),
		Image =  "rbxasset://textures/ui/Settings/Slider/Left.png",
		ImageColor3 = ARROW_COLOR,
		ZIndex = 4,
		Parent = leftButton
	};
	local rightButtonImage = Util.Create'ImageLabel'
	{
		Name = "RightButton",
		BackgroundTransparency = 1,
		AnchorPoint = Vector2.new(0.5, 0.5),
		Position = UDim2.new(0.5,0,0.5,0),
		Size =  UDim2.new(0,18,0,30),
		Image =  "rbxasset://textures/ui/Settings/Slider/Right.png",
		ImageColor3 = ARROW_COLOR,
		ZIndex = 4,
		Parent = rightButton
	};
	if not UserInputService.TouchEnabled then
		local applyNormal, applyHover =
			function(instance) instance.ImageColor3 = ARROW_COLOR end,
			function(instance) instance.ImageColor3 = ARROW_COLOR_HOVER end
		addHoverState(leftButton, leftButtonImage, applyNormal, applyHover)
		addHoverState(rightButton, rightButtonImage, applyNormal, applyHover)
	end


	this.Selections = {}
	local isSelectionLabelVisible = {}
	local isAutoSelectButton = {}

	local autoSelectButton = Util.Create'ImageButton'{
		Name = 'AutoSelectButton',
		BackgroundTransparency = 1,
		Image = '',
		Position = UDim2.new(0, leftButton.Size.X.Offset, 0, 0),
		Size = UDim2.new(1, leftButton.Size.X.Offset * -2, 1, 0),
		Parent = this.SelectorFrame,
		ZIndex = 2,
		SelectionImageObject = noSelectionObject
	}
	autoSelectButton.MouseButton1Click:Connect(function()
		if not interactable then return end
		if #this.Selections <= 1 then return end
		local newIndex = this.CurrentIndex + 1
		if newIndex > #this.Selections then
			newIndex = 1
		end
		this:SetSelectionIndex(newIndex)
		if usesSelectedObject() then
			GuiService.SelectedCoreObject = this.SelectorFrame
		end
	end)
	isAutoSelectButton[autoSelectButton] = true

	---------------------- FUNCTIONS -----------------------------------
	local function setSelection(index, direction)
		for i, selectionLabel in pairs(this.Selections) do
			local isSelected = (i == index)

			local leftButtonUDim = UDim2.new(0,leftButton.Size.X.Offset,0,0)
			local tweenPos = UDim2.new(0,leftButton.Size.X.Offset * direction * 3,0,0)

			if isSelectionLabelVisible[selectionLabel] then
				tweenPos = UDim2.new(0,leftButton.Size.X.Offset * -direction * 3,0,0)
			end

			if tweenPos.X.Offset < 0 then
				tweenPos = UDim2.new(0,tweenPos.X.Offset + (selectionLabel.AbsoluteSize.X/4),0,0)
			end

			if isSelected then
				isSelectionLabelVisible[selectionLabel] = true
				selectionLabel.Position = tweenPos
				selectionLabel.Visible = true
				PropertyTweener(selectionLabel, "TextTransparency", 1, 0, TweenTime * 1.1, EaseOutQuad)
				if selectionLabel:IsDescendantOf(game) then
					selectionLabel:TweenPosition(leftButtonUDim, Enum.EasingDirection.In, Enum.EasingStyle.Quad, TweenTime, true)
				else
					selectionLabel.Position = leftButtonUDim
				end
				this.CurrentIndex = i
				indexChangedEvent:Fire(index)
			elseif isSelectionLabelVisible[selectionLabel] then
				isSelectionLabelVisible[selectionLabel] = false
				PropertyTweener(selectionLabel, "TextTransparency", 0, 1, TweenTime * 1.1, EaseOutQuad)
				if selectionLabel:IsDescendantOf(game) then
					selectionLabel:TweenPosition(tweenPos, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, TweenTime * 0.9, true)
				else
					selectionLabel.Position = UDim2.new(tweenPos)
				end
			end
		end
	end

	local function stepFunc(inputObject, step)
		if not interactable then return end

		if inputObject ~= nil and inputObject.UserInputType ~= Enum.UserInputType.MouseButton1 and
			inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 and inputObject.UserInputType ~= Enum.UserInputType.Gamepad2 and
			inputObject.UserInputType ~= Enum.UserInputType.Gamepad3 and inputObject.UserInputType ~= Enum.UserInputType.Gamepad4 and
			inputObject.UserInputType ~= Enum.UserInputType.Keyboard then return end

		if usesSelectedObject() then
			GuiService.SelectedCoreObject = this.SelectorFrame
		end

		local newIndex = step + this.CurrentIndex

		local direction = 0
		if newIndex > this.CurrentIndex then
			direction = 1
		else
			direction = -1
		end

		if newIndex > #this.Selections then
			newIndex = 1
		elseif newIndex < 1 then
			newIndex = #this.Selections
		end

		setSelection(newIndex, direction)
	end

	local guiServiceCon = nil
	local function connectToGuiService()
		guiServiceCon = GuiService:GetPropertyChangedSignal("SelectedCoreObject"):Connect(function()
			if #this.Selections <= 0 then
				return
			end

			if GuiService.SelectedCoreObject == this.SelectorFrame then
				this.Selections[this.CurrentIndex].TextTransparency = 0
			else
				if GuiService.SelectedCoreObject ~= nil and isAutoSelectButton[GuiService.SelectedCoreObject] then
					if VRService.VREnabled then
						this.Selections[this.CurrentIndex].TextTransparency = 0
					else
						GuiService.SelectedCoreObject = this.SelectorFrame
					end
				else
					this.Selections[this.CurrentIndex].TextTransparency = 0.5
				end
			end
		end)
	end

	--------------------- PUBLIC FACING FUNCTIONS -----------------------
	this.IndexChanged = indexChangedEvent.Event

	function this:SetSelectionIndex(newIndex)
		setSelection(newIndex, 1)
	end

	function this:GetSelectedIndex()
		return this.CurrentIndex
	end

	function this:SetZIndex(newZIndex)
		leftButton.ZIndex = newZIndex
		rightButton.ZIndex = newZIndex
		leftButtonImage.ZIndex = newZIndex
		rightButtonImage.ZIndex = newZIndex

		for i = 1, #this.Selections do
			this.Selections[i].ZIndex = newZIndex
		end
	end

	function this:SetInteractable(value)
		interactable = value
		this.SelectorFrame.Selectable = interactable

		leftButton.Active = interactable
		rightButton.Active = interactable

		if not interactable then
			for i, selectionLabel in pairs(this.Selections) do
				selectionLabel.TextColor3 = Color3.fromRGB(49, 49, 49)
			end
			leftButtonImage.ImageColor3 = ARROW_COLOR_INACTIVE
            rightButtonImage.ImageColor3 = ARROW_COLOR_INACTIVE
		else
			for i, selectionLabel in pairs(this.Selections) do
				selectionLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
			end
			leftButtonImage.ImageColor3 = ARROW_COLOR
            rightButtonImage.ImageColor3 = ARROW_COLOR
		end
	end

	function this:UpdateOptions(selectionStringTable)
		for i,v in pairs(this.Selections) do
			v:Destroy()
		end

		isSelectionLabelVisible = {}
		this.Selections = {}

		for i,v in pairs(selectionStringTable) do
			local nextSelection = Util.Create'TextLabel'
			{
				Name = "Selection" .. tostring(i),
				BackgroundTransparency = 1,
				BorderSizePixel = 0,
				Size = UDim2.new(1,leftButton.Size.X.Offset * -2, 1, 0),
				Position = UDim2.new(1,0,0,0),
				TextColor3 = Color3.fromRGB(255, 255, 255),
				TextYAlignment = Enum.TextYAlignment.Center,
				TextTransparency = 0.5,
				Font = Enum.Font.SourceSans,
				TextSize = 24,
				Text = v,
				ZIndex = 2,
				Visible = false,
				Parent = this.SelectorFrame
			};
			if isTenFootInterface() then
				nextSelection.TextSize = 36
			end

			if i == startPosition then
				this.CurrentIndex = i
				nextSelection.Position = UDim2.new(0,leftButton.Size.X.Offset,0,0)
				nextSelection.Visible = true

				isSelectionLabelVisible[nextSelection] = true
			else
				isSelectionLabelVisible[nextSelection] = false
			end

			this.Selections[i] = nextSelection
		end

		local hasMoreThanOneSelection = #this.Selections > 1
		leftButton.Visible = hasMoreThanOneSelection
		rightButton.Visible = hasMoreThanOneSelection
	end

	--------------------- SETUP -----------------------
	local function onVREnabled(prop)
		if prop ~= "VREnabled" then
			return
		end
		local vrEnabled = VRService.VREnabled
		leftButton.Selectable = vrEnabled
		rightButton.Selectable = vrEnabled
		autoSelectButton.Selectable = vrEnabled
	end
	VRService.Changed:Connect(onVREnabled)
	onVREnabled("VREnabled")

	leftButton.InputBegan:Connect(function(inputObject)
		if inputObject.UserInputType == Enum.UserInputType.Touch then
			stepFunc(nil, -1)
		end
	end)
	leftButton.MouseButton1Click:Connect(function()
		if not UserInputService.TouchEnabled then
			stepFunc(nil, -1)
		end
	end)
	rightButton.InputBegan:Connect(function(inputObject)
		if inputObject.UserInputType == Enum.UserInputType.Touch then
			stepFunc(nil, 1)
		end
	end)
	rightButton.MouseButton1Click:Connect(function()
		if not UserInputService.TouchEnabled then
			stepFunc(nil, 1)
		end
	end)

	local isInTree = true
	this:UpdateOptions(selectionStringTable)

	UserInputService.InputBegan:Connect(function(inputObject)
		if not interactable then return end
		if not isInTree then return end

		if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 and inputObject.UserInputType ~= Enum.UserInputType.Keyboard then return end
		if GuiService.SelectedCoreObject ~= this.SelectorFrame then return end

		if inputObject.KeyCode == Enum.KeyCode.DPadLeft or inputObject.KeyCode == Enum.KeyCode.Left or inputObject.KeyCode == Enum.KeyCode.A then
			stepFunc(inputObject, -1)
		elseif inputObject.KeyCode == Enum.KeyCode.DPadRight or inputObject.KeyCode == Enum.KeyCode.Right or inputObject.KeyCode == Enum.KeyCode.D then
			stepFunc(inputObject, 1)
		end
	end)

	UserInputService.InputChanged:Connect(function(inputObject)
		if not interactable then return end
		if not isInTree then lastInputDirection = 0 return end

		if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 then return end

		local selected = GuiService.SelectedCoreObject
		if not selected or not selected:IsDescendantOf(this.SelectorFrame.Parent) then return end

		if inputObject.KeyCode ~= Enum.KeyCode.Thumbstick1 then return end


		if inputObject.Position.X > CONTROLLER_THUMBSTICK_DEADZONE and inputObject.Delta.X > 0 and lastInputDirection ~= 1 then
			lastInputDirection = 1
			stepFunc(inputObject, lastInputDirection)
		elseif inputObject.Position.X < -CONTROLLER_THUMBSTICK_DEADZONE and inputObject.Delta.X < 0 and lastInputDirection ~= -1 then
			lastInputDirection = -1
			stepFunc(inputObject, lastInputDirection)
		elseif math.abs(inputObject.Position.X) < CONTROLLER_THUMBSTICK_DEADZONE then
			lastInputDirection = 0
		end
	end)

	this.SelectorFrame.AncestryChanged:Connect(function(child, parent)
		isInTree = parent
		if not isInTree then
			if guiServiceCon then guiServiceCon:Disconnect() end
		else
			connectToGuiService()
		end
	end)

	local function onResized(viewportSize, portrait)
		local textSize = 0
		if portrait then
			textSize = 16
		else
			textSize = isTenFootInterface() and 36 or 24
		end

		for i, selection in pairs(this.Selections) do
			selection.TextSize = textSize
		end
	end
	addOnResizedCallback(this.SelectorFrame, onResized)

	connectToGuiService()

	return this
end

local function ShowAlert(alertMessage, okButtonText, settingsHub, okPressedFunc, hasBackground)
	local parent = CoreGui.RobloxGui
	if parent:FindFirstChild("AlertViewFullScreen") then return end

	--Declare AlertViewBacking so onVREnabled can take it as an upvalue
	local AlertViewBacking = nil

	--Handle VR toggle while alert is open
	--Future consideration: maybe rebuild gui when VR toggles mid-game; right now only subpaneling is handled rather than visual style
	local function onVREnabled(prop)
		if prop ~= "VREnabled" then return end
		local Panel3D, settingsPanel = nil, nil
		if VRService.VREnabled then
			Panel3D = require(CoreGui.RobloxGui.Modules.VR.Panel3D)
			settingsPanel = Panel3D.Get("SettingsMenu")
			parent = settingsPanel:GetGUI()
		else
			parent = CoreGui.RobloxGui
		end
		if AlertViewBacking and AlertViewBacking.Parent ~= nil then
			AlertViewBacking.Parent = parent
			if VRService.VREnabled then
				settingsPanel:SetSubpanelDepth(AlertViewBacking, 0.5)
			end
		end
	end
	local vrEnabledConn = VRService.Changed:Connect(onVREnabled)

	local NON_SELECTED_TEXT_COLOR = Color3.fromRGB(59, 166, 241)
	local SELECTED_TEXT_COLOR = Color3.fromRGB(255, 255, 255)

	AlertViewBacking = Util.Create'ImageLabel'
	{
		Name = "AlertViewBacking",
		Image = "rbxasset://textures/ui/Settings/MenuBarAssets/MenuButton.png",
		ScaleType = Enum.ScaleType.Slice,
		SliceCenter = Rect.new(8,6,46,44),
		BackgroundTransparency = 1,

		ImageTransparency = 1,
		Size = UDim2.new(0, 400, 0, 350),
		Position = UDim2.new(0.5, -200, 0.5, -175),
		ZIndex = 9,
		Parent = parent
	};
	onVREnabled("VREnabled")
	if hasBackground or VRService.VREnabled then
		AlertViewBacking.ImageTransparency = 0
	else
		AlertViewBacking.Size = UDim2.new(0.8, 0, 0, 350)
		AlertViewBacking.Position = UDim2.new(0.1, 0, 0.1, 0)
	end

	if CoreGui.RobloxGui.AbsoluteSize.Y <= AlertViewBacking.Size.Y.Offset then
		AlertViewBacking.Size = UDim2.new(AlertViewBacking.Size.X.Scale, AlertViewBacking.Size.X.Offset,
											AlertViewBacking.Size.Y.Scale, CoreGui.RobloxGui.AbsoluteSize.Y)
		AlertViewBacking.Position = UDim2.new(AlertViewBacking.Position.X.Scale, -AlertViewBacking.Size.X.Offset/2, 0.5, -AlertViewBacking.Size.Y.Offset/2)
	end

	local AlertViewText = Util.Create'TextLabel'
	{
		Name = "AlertViewText",
		BackgroundTransparency = 1,
		Size = UDim2.new(0.95, 0, 0.6, 0),
		Position = UDim2.new(0.025, 0, 0.05, 0),
		Font = Enum.Font.SourceSansBold,
		TextSize = 36,
		Text = alertMessage,
		TextWrapped = true,
		TextColor3 = Color3.fromRGB(255, 255, 255),
		TextXAlignment = Enum.TextXAlignment.Center,
		TextYAlignment = Enum.TextYAlignment.Center,
		ZIndex = 10,
		Parent = AlertViewBacking
	};

	local SelectionOverrideObject = Util.Create'ImageLabel'
	{
		Image = "",
		BackgroundTransparency = 1
	};

	local removeId = HttpService:GenerateGUID(false)

	local destroyAlert = function(actionName, inputState)
		if VRService.VREnabled and (inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Cancel) then
			return
		end
		if not AlertViewBacking then
			return
		end
		if VRService.VREnabled then
			local Panel3D = require(CoreGui.RobloxGui.Modules.VR.Panel3D)
			Panel3D.Get("SettingsMenu"):SetSubpanelDepth(AlertViewBacking, 0)
		end
		AlertViewBacking:Destroy()
		AlertViewBacking = nil
		if okPressedFunc then
			okPressedFunc()
		end
		ContextActionService:UnbindAction(removeId)
		GuiService.SelectedCoreObject = nil
		if settingsHub then
			settingsHub:ShowBar()
		end
		if vrEnabledConn then
			vrEnabledConn:Disconnect()
		end
	end

	local AlertViewButtonSize = UDim2.new(1, -20, 0, 60)
	local AlertViewButtonPosition = UDim2.new(0, 10, 0.65, 0)
	if not hasBackground then
		AlertViewButtonSize = UDim2.new(0, 200, 0, 50)
		AlertViewButtonPosition = UDim2.new(0.5, -100, 0.65, 0)
	end

	local AlertViewButton, AlertViewText = MakeButton("AlertViewButton", okButtonText, AlertViewButtonSize, destroyAlert)
	AlertViewButton.Position = AlertViewButtonPosition
	AlertViewButton.NextSelectionLeft = AlertViewButton
	AlertViewButton.NextSelectionRight = AlertViewButton
	AlertViewButton.NextSelectionUp = AlertViewButton
	AlertViewButton.NextSelectionDown = AlertViewButton
	AlertViewButton.ZIndex = 9
	AlertViewText.ZIndex = AlertViewButton.ZIndex
	AlertViewButton.Parent = AlertViewBacking

	if usesSelectedObject() then
		GuiService.SelectedCoreObject = AlertViewButton
	end

	GuiService.SelectedCoreObject = AlertViewButton

	ContextActionService:BindActionAtPriority(removeId, destroyAlert, false, Enum.ContextActionPriority.High.Value, Enum.KeyCode.Escape, Enum.KeyCode.ButtonB, Enum.KeyCode.ButtonA)

	if settingsHub and not VRService.VREnabled then
		settingsHub:HideBar()
		settingsHub.Pages.CurrentPage:Hide(1, 1)
	end
end

local function CreateNewSlider(numOfSteps, startStep, minStep)
	-------------------- SETUP ------------------------
	local this = {}

	local spacing = 4
	local initialSpacing = 8
	local steps = tonumber(numOfSteps)
	local currentStep = startStep

	local lastInputDirection = 0
	local timeAtLastInput = nil

	local interactable = true

	local renderStepBindName = HttpService:GenerateGUID(false)

	-- this is done to prevent using these values below (trying to keep the variables consistent)
	numOfSteps = ""
	startStep = ""

	if steps <= 0 then
		error("CreateNewSlider failed because numOfSteps (first arg) is 0 or negative, please supply a positive integer", 2)
		return
	end

	local valueChangedEvent = Instance.new("BindableEvent")
	valueChangedEvent.Name = "ValueChanged"

	----------------- GUI SETUP ------------------------
	this.SliderFrame = Util.Create'ImageButton'
	{
		Name = "Slider",
		Image = "",
		AutoButtonColor = false,
		NextSelectionLeft = this.SliderFrame,
		NextSelectionRight = this.SliderFrame,
		BackgroundTransparency = 1,
		Size = UDim2.new(0.6, 0, 0, 50),
		Position = UDim2.new(1, 0, 0.5, 0),
		AnchorPoint = Vector2.new(1, 0.5),
		SelectionImageObject = noSelectionObject,
		ZIndex = 2
	};

	this.StepsContainer = Util.Create "Frame"
	{
		Name = "StepsContainer",
		Position = UDim2.new(0.5, 0, 0.5, 0),
		Size = UDim2.new(1, -100, 1, 0),
		AnchorPoint = Vector2.new(0.5, 0.5),
		BackgroundTransparency = 1,
		Parent = this.SliderFrame,
	}

	local leftButton = Util.Create'ImageButton'
	{
		Name = "LeftButton",
		BackgroundTransparency = 1,
		AnchorPoint = Vector2.new(0, 0.5),
		Position = UDim2.new(0,0,0.5,0),
		Size =  UDim2.new(0,50,0,50),
		Image =  "",
		ZIndex = 3,
		Selectable = false,
		SelectionImageObject = noSelectionObject,
		Active = true,
		Parent = this.SliderFrame
	};
	local rightButton = Util.Create'ImageButton'
	{
		Name = "RightButton",
		BackgroundTransparency = 1,
		AnchorPoint = Vector2.new(1, 0.5),
		Position = UDim2.new(1,0,0.5,0),
		Size =  UDim2.new(0,50,0,50),
		Image =  "",
		ZIndex = 3,
		Selectable = false,
		SelectionImageObject = noSelectionObject,
		Active = true,
		Parent = this.SliderFrame
	};

	local leftButtonImage = Util.Create'ImageLabel'
	{
		Name = "LeftButton",
		BackgroundTransparency = 1,
		AnchorPoint = Vector2.new(0.5, 0.5),
		Position = UDim2.new(0.5,0,0.5,0),
		Size =  UDim2.new(0,30,0,30),
		Image =  "rbxasset://textures/ui/Settings/Slider/Less.png",
		ZIndex = 4,
		Parent = leftButton,
		ImageColor3 = UserInputService.TouchEnabled and ARROW_COLOR_TOUCH or ARROW_COLOR
	};
	local rightButtonImage = Util.Create'ImageLabel'
	{
		Name = "RightButton",
		BackgroundTransparency = 1,
		AnchorPoint = Vector2.new(0.5, 0.5),
		Position = UDim2.new(0.5,0,0.5,0),
		Size =  UDim2.new(0,30,0,30),
		Image =  "rbxasset://textures/ui/Settings/Slider/More.png",
		ZIndex = 4,
		Parent = rightButton,
		ImageColor3 = UserInputService.TouchEnabled and ARROW_COLOR_TOUCH or ARROW_COLOR
	};
	if not UserInputService.TouchEnabled then
		local onNormalButtonState, onHoverButtonState =
			function(instance) instance.ImageColor3 = ARROW_COLOR end,
			function(instance) instance.ImageColor3 = ARROW_COLOR_HOVER end

		addHoverState(leftButton, leftButtonImage, onNormalButtonState, onHoverButtonState)
		addHoverState(rightButton, rightButtonImage, onNormalButtonState, onHoverButtonState)
	end

	this.Steps = {}
	local stepXSize = 35
	if isSmallTouchScreen() then
		stepXSize = 25
	end

	local stepXScale = 1 / steps
	stepXSize = 0

	for i = 1, steps do
		local nextStep = Util.Create'ImageButton'
		{
			Name = "Step" .. tostring(i),
			BackgroundColor3 = SELECTED_COLOR,
			BackgroundTransparency = 0.36,
			BorderSizePixel = 0,
			AutoButtonColor = false,
			Active = false,
			AnchorPoint = Vector2.new(0, 0.5),
			Position = UDim2.new((i - 1) * stepXScale, spacing / 2, 0.5, 0),
			Size =  UDim2.new(stepXScale,-spacing, 24 / 50, 0),
			Image =  "",
			ZIndex = 3,
			Selectable = false,
			ImageTransparency = 0.36,
			Parent = this.StepsContainer,
			SelectionImageObject = noSelectionObject
		};

		if i > currentStep then
			nextStep.BackgroundColor3 = NON_SELECTED_COLOR
		end

		if i == 1 or i == steps then
			nextStep.BackgroundTransparency = 1
			nextStep.ScaleType = Enum.ScaleType.Slice
			nextStep.SliceCenter = Rect.new(3,3,32,21)

			if i <= currentStep then
				if i == 1 then
					nextStep.Image = SELECTED_LEFT_IMAGE
				else
					nextStep.Image = SELECTED_RIGHT_IMAGE
				end
			else
				if i == 1 then
					nextStep.Image = NON_SELECTED_LEFT_IMAGE
				else
					nextStep.Image = NON_SELECTED_RIGHT_IMAGE
				end
			end
		end

		this.Steps[#this.Steps + 1] = nextStep
	end


	------------------- FUNCTIONS ---------------------
	local function hideSelection()
		for i = 1, steps do
			this.Steps[i].BackgroundColor3 = NON_SELECTED_COLOR
			if i == 1 then
				this.Steps[i].Image = NON_SELECTED_LEFT_IMAGE
			elseif i == steps then
				this.Steps[i].Image = NON_SELECTED_RIGHT_IMAGE
			end
		end
	end
	local function showSelection()
		for i = 1, steps do
			if i > currentStep then break end
			this.Steps[i].BackgroundColor3 = SELECTED_COLOR
			if i == 1 then
				this.Steps[i].Image = SELECTED_LEFT_IMAGE
			elseif i == steps then
				this.Steps[i].Image = SELECTED_RIGHT_IMAGE
			end
		end
	end
	local function modifySelection(alpha)
		for i = 1, steps do
			if i == 1 or i == steps then
				this.Steps[i].ImageTransparency = alpha
			else
				this.Steps[i].BackgroundTransparency = alpha
			end
		end
	end

	local function setCurrentStep(newStepPosition)
		if not minStep then minStep = 0 end

		leftButton.Visible = true
		rightButton.Visible = true

		if newStepPosition <= minStep then
			newStepPosition = minStep
			leftButton.Visible = false
		end
		if newStepPosition >= steps then
			newStepPosition = steps
			rightButton.Visible = false
		end

		if currentStep == newStepPosition then return end

		currentStep = newStepPosition

		hideSelection()
		showSelection()

		timeAtLastInput = tick()
		valueChangedEvent:Fire(currentStep)
	end

	local function isActivateEvent(inputObject)
		if not inputObject then return false end
		return inputObject.UserInputType == Enum.UserInputType.MouseButton1 or inputObject.UserInputType == Enum.UserInputType.Touch or (inputObject.UserInputType == Enum.UserInputType.Gamepad1 and inputObject.KeyCode == Enum.KeyCode.ButtonA)
	end
	local function mouseDownFunc(inputObject, newStepPos, repeatAction)
		if not interactable then return end

		if inputObject == nil then return end

		if not isActivateEvent(inputObject) then return end

		if usesSelectedObject() and not VRService.VREnabled then
			GuiService.SelectedCoreObject = this.SliderFrame
		end

		if not VRService.VREnabled then
			if repeatAction then
				lastInputDirection = newStepPos - currentStep
			else
				lastInputDirection = 0

				local mouseInputMovedCon = nil
				local mouseInputEndedCon = nil

				mouseInputMovedCon = UserInputService.InputChanged:Connect(function(inputObject)
					if inputObject.UserInputType ~= Enum.UserInputType.MouseMovement then return end

					local mousePos = inputObject.Position.X
					for i = 1, steps do
						local stepPosition = this.Steps[i].AbsolutePosition.X
						local stepSize = this.Steps[i].AbsoluteSize.X
						if mousePos >= stepPosition and mousePos <= stepPosition + stepSize then
							setCurrentStep(i)
							break
						elseif i == 1 and mousePos < stepPosition then
							setCurrentStep(0)
							break
						elseif i == steps and mousePos >= stepPosition then
							setCurrentStep(i)
							break
						end
					end
				end)
				mouseInputEndedCon = UserInputService.InputEnded:Connect(function(inputObject)
					if not isActivateEvent(inputObject) then return end

					lastInputDirection = 0
					mouseInputEndedCon:Disconnect()
					mouseInputMovedCon:Disconnect()
				end)
			end
		else
			lastInputDirection = 0
		end

		setCurrentStep(newStepPos)
	end

	local function mouseUpFunc(inputObject)
		if not interactable then return end
		if not isActivateEvent(inputObject) then return end

		lastInputDirection = 0
	end

	local function touchClickFunc(inputObject, newStepPos, repeatAction)
		mouseDownFunc(inputObject, newStepPos, repeatAction)
	end

	--------------------- PUBLIC FACING FUNCTIONS -----------------------
	this.ValueChanged = valueChangedEvent.Event

	function this:SetValue(newValue)
		setCurrentStep(newValue)
	end

	function this:GetValue()
		return currentStep
	end

	function this:SetInteractable(value)
		lastInputDirection = 0
		interactable = value
		this.SliderFrame.Selectable = value
		if not interactable then
			hideSelection()
		else
			showSelection()
		end
	end

	function this:SetZIndex(newZIndex)
		leftButton.ZIndex = newZIndex
		rightButton.ZIndex = newZIndex
		leftButtonImage.ZIndex = newZIndex
		rightButtonImage.ZIndex = newZIndex

		for i = 1, #this.Steps do
			this.Steps[i].ZIndex = newZIndex
		end
	end

	function this:SetMinStep(newMinStep)
		if newMinStep >= 0 and newMinStep <= steps then
			minStep = newMinStep
		end

		if currentStep <= minStep then
			currentStep = minStep
			leftButton.Visible = false
		end
		if currentStep >= steps then
			currentStep = steps
			rightButton.Visible = false
		end
	end

	--------------------- SETUP -----------------------

	leftButton.InputBegan:Connect(function(inputObject) mouseDownFunc(inputObject, currentStep - 1, true) end)
	leftButton.InputEnded:Connect(function(inputObject) mouseUpFunc(inputObject) end)
	rightButton.InputBegan:Connect(function(inputObject) mouseDownFunc(inputObject, currentStep + 1, true) end)
	rightButton.InputEnded:Connect(function(inputObject) mouseUpFunc(inputObject) end)

	local function onVREnabled(prop)
		if prop ~= "VREnabled" then
			return
		end
		if VRService.VREnabled then
			leftButton.Selectable = interactable
			rightButton.Selectable = interactable
			this.SliderFrame.Selectable = interactable

			for i = 1, steps do
				this.Steps[i].Selectable = interactable
				this.Steps[i].Active = interactable
			end
		else
			leftButton.Selectable = false
			rightButton.Selectable = false
			this.SliderFrame.Selectable = interactable
			for i = 1, steps do
				this.Steps[i].Selectable = false
				this.Steps[i].Active = false
			end
		end
	end
	VRService.Changed:Connect(onVREnabled)
	onVREnabled("VREnabled")

	for i = 1, steps do
		this.Steps[i].InputBegan:Connect(function(inputObject)
			mouseDownFunc(inputObject, i)
		end)
		this.Steps[i].InputEnded:Connect(function(inputObject)
		 mouseUpFunc(inputObject) end)
	end

	this.SliderFrame.InputBegan:Connect(function(inputObject)
		if VRService.VREnabled then
			local selected = GuiService.SelectedCoreObject
			if not selected or not selected:IsDescendantOf(this.SliderFrame.Parent) then return end
		end
		mouseDownFunc(inputObject, currentStep)
	end)
	this.SliderFrame.InputEnded:Connect(function(inputObject)
		if VRService.VREnabled then
			local selected = GuiService.SelectedCoreObject
			if not selected or not selected:IsDescendantOf(this.SliderFrame.Parent) then return end
		end
		mouseUpFunc(inputObject)
	end)


	local stepSliderFunc = function()
		if timeAtLastInput == nil then return end

		local currentTime = tick()
		local timeSinceLastInput = currentTime - timeAtLastInput
		if timeSinceLastInput >= CONTROLLER_SCROLL_DELTA then
			setCurrentStep(currentStep + lastInputDirection)
		end
	end

	local isInTree = true

	local navigateLeft = -1 --these are just for differentiation, the actual value isn't important as long as they coerce to boolean true (all numbers do in Lua)
	local navigateRight = 1
	local navigationKeyCodes = {
		[Enum.KeyCode.Thumbstick1] = true, --thumbstick can be either direction
		[Enum.KeyCode.DPadLeft] = navigateLeft,
		[Enum.KeyCode.DPadRight] = navigateRight,
		[Enum.KeyCode.Left] = navigateLeft,
		[Enum.KeyCode.Right] = navigateRight,
		[Enum.KeyCode.A] = navigateLeft,
		[Enum.KeyCode.D] = navigateRight,
		[Enum.KeyCode.ButtonA] = true --buttonA can be either direction
	}
	UserInputService.InputBegan:Connect(function(inputObject)
		if not interactable then return end
		if not isInTree then return end

		if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 and inputObject.UserInputType ~= Enum.UserInputType.Keyboard then return end
		local selected = GuiService.SelectedCoreObject
		if not selected or not selected:IsDescendantOf(this.SliderFrame.Parent) then return end

		if navigationKeyCodes[inputObject.KeyCode] == navigateLeft then
			lastInputDirection = -1
			setCurrentStep(currentStep - 1)
		elseif navigationKeyCodes[inputObject.KeyCode] == navigateRight then
			lastInputDirection = 1
			setCurrentStep(currentStep + 1)
		end
	end)

	UserInputService.InputEnded:Connect(function(inputObject)
		if not interactable then return end

		if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 and inputObject.UserInputType ~= Enum.UserInputType.Keyboard then return end
		local selected = GuiService.SelectedCoreObject
		if not selected or not selected:IsDescendantOf(this.SliderFrame.Parent) then return end

		if navigationKeyCodes[inputObject.KeyCode] then --detect any keycode considered a navigation key
			lastInputDirection = 0
		end
	end)

	UserInputService.InputChanged:Connect(function(inputObject)
		if not interactable then
			lastInputDirection = 0
			return
		end
		if not isInTree then
			lastInputDirection = 0
			return
		end

		if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 then return end
		local selected = GuiService.SelectedCoreObject
		if not selected or not selected:IsDescendantOf(this.SliderFrame.Parent) then return end
		if inputObject.KeyCode ~= Enum.KeyCode.Thumbstick1 then return end

		if inputObject.Position.X > CONTROLLER_THUMBSTICK_DEADZONE and inputObject.Delta.X > 0 and lastInputDirection ~= 1 then
			lastInputDirection = 1
			setCurrentStep(currentStep + 1)
		elseif inputObject.Position.X < -CONTROLLER_THUMBSTICK_DEADZONE and inputObject.Delta.X < 0 and lastInputDirection ~= -1 then
			lastInputDirection = -1
			setCurrentStep(currentStep - 1)
		elseif math.abs(inputObject.Position.X) < CONTROLLER_THUMBSTICK_DEADZONE then
			lastInputDirection = 0
		end
	end)

	local isBound = false
	GuiService.Changed:Connect(function(prop)
		if prop ~= "SelectedCoreObject" then return end

		local selected = GuiService.SelectedCoreObject
		local isThisSelected = selected and selected:IsDescendantOf(this.SliderFrame.Parent)
		if isThisSelected then
			modifySelection(0)
			if not isBound then
				isBound = true
				timeAtLastInput = tick()
				RunService:BindToRenderStep(renderStepBindName, Enum.RenderPriority.Input.Value + 1, stepSliderFunc)
			end
		else
			modifySelection(0.36)
			if isBound then
				isBound = false
				RunService:UnbindFromRenderStep(renderStepBindName)
			end
		end
	end)

	this.SliderFrame.AncestryChanged:Connect(function(child, parent)
		isInTree = parent
	end)

	setCurrentStep(currentStep)

	return this
end

local ROW_HEIGHT = 50
if isTenFootInterface() then ROW_HEIGHT = 90 end

local nextPosTable = {}
local function AddNewRow(pageToAddTo, rowDisplayName, selectionType, rowValues, rowDefault, extraSpacing)
	local nextRowPositionY = 0
	local isARealRow = selectionType ~= 'TextBox' -- Textboxes are constructed in this function - they don't have an associated class.

	if nextPosTable[pageToAddTo] then
		nextRowPositionY = nextPosTable[pageToAddTo]
	end

	local RowFrame = nil
	RowFrame = Util.Create'ImageButton'
	{
		Name = rowDisplayName .. "Frame",
		BackgroundTransparency = 1,
		BorderSizePixel = 0,
		Image = "rbxasset://textures/ui/VR/rectBackgroundWhite.png",
		ScaleType = Enum.ScaleType.Slice,
		SliceCenter = Rect.new(2, 2, 18, 18),
		ImageTransparency = 1,
		Active = false,
		AutoButtonColor = false,
		Size = UDim2.new(1,0,0,ROW_HEIGHT),
		Position = UDim2.new(0,0,0,nextRowPositionY),
		ZIndex = 2,
		Selectable = false,
		SelectionImageObject = noSelectionObject,
		Parent = pageToAddTo.Page
	};
	RowFrame.ImageColor3 = RowFrame.BackgroundColor3

	if RowFrame and extraSpacing then
		RowFrame.Position = UDim2.new(RowFrame.Position.X.Scale,RowFrame.Position.X.Offset,
			RowFrame.Position.Y.Scale,RowFrame.Position.Y.Offset + extraSpacing)
	end

	local RowLabel = nil
	RowLabel = Util.Create'TextLabel'
	{
		Name = rowDisplayName .. "Label",
		Text = rowDisplayName,
		Font = Enum.Font.SourceSansBold,
		TextSize = 16,
		TextColor3 = Color3.fromRGB(255,255,255),
		TextXAlignment = Enum.TextXAlignment.Left,
		BackgroundTransparency = 1,
		Size = UDim2.new(0,200,1,0),
		Position = UDim2.new(0,10,0,0),
		ZIndex = 2,
		Parent = RowFrame
	};

	local RowLabelTextSizeConstraint = Instance.new("UITextSizeConstraint")
	if FFlagUseNotificationsLocalization then
		RowLabel.Size = UDim2.new(0.35,0,1,0)
		RowLabel.TextScaled = true
		RowLabel.TextWrapped = true
		RowLabelTextSizeConstraint.Parent = RowLabel
		RowLabelTextSizeConstraint.MaxTextSize = 16
	end

	if not isARealRow then
		RowLabel.Text = ''
	end

	local function onResized(viewportSize, portrait)
		if portrait then
			RowLabel.TextSize = 16
		else
			RowLabel.TextSize = isTenFootInterface() and 36 or 24
		end
		RowLabelTextSizeConstraint.MaxTextSize = RowLabel.TextSize
	end
	onResized(getViewportSize(), isPortrait())
	addOnResizedCallback(RowFrame, onResized)

	local ValueChangerSelection = nil
	local ValueChangerInstance = nil
	if selectionType == "Slider" then
		ValueChangerInstance = CreateNewSlider(rowValues, rowDefault)
		ValueChangerInstance.SliderFrame.Parent = RowFrame
		ValueChangerSelection = ValueChangerInstance.SliderFrame
	elseif selectionType == "Selector" then
		ValueChangerInstance = CreateSelector(rowValues, rowDefault)
		ValueChangerInstance.SelectorFrame.Parent = RowFrame
		ValueChangerSelection = ValueChangerInstance.SelectorFrame
	elseif selectionType == "DropDown" then
		ValueChangerInstance = CreateDropDown(rowValues, rowDefault, pageToAddTo.HubRef)
		ValueChangerInstance.DropDownFrame.Parent = RowFrame
		ValueChangerSelection = ValueChangerInstance.DropDownFrame
	elseif selectionType == "TextBox" then
		local isMouseOverRow = false
		local forceReturnSelectionOnFocusLost = false
		local SelectionOverrideObject = Util.Create'ImageLabel'
		{
			Image = "",
			BackgroundTransparency = 1,
		};

		ValueChangerInstance = {}
		ValueChangerInstance.HubRef = nil

		local box = Util.Create'TextBox'
		{
			AnchorPoint = Vector2.new(1, 0.5),
			Size = UDim2.new(0.6,0,1,0),
			Position = UDim2.new(1,0,0.5,0),
			Text = rowDisplayName,
			TextColor3 = Color3.fromRGB(49, 49, 49),
			BackgroundTransparency = 0.5,
			BorderSizePixel = 0,
			TextYAlignment = Enum.TextYAlignment.Top,
			TextXAlignment = Enum.TextXAlignment.Left,
			TextWrapped = true,
			Font = Enum.Font.SourceSans,
			TextSize = 24,
			ZIndex = 2,
			SelectionImageObject = SelectionOverrideObject,
			ClearTextOnFocus = false,
			Parent = RowFrame
		};
		ValueChangerSelection = box

		box.Focused:Connect(function()
			if usesSelectedObject() then
				GuiService.SelectedCoreObject = box
			end

			if box.Text == rowDisplayName then
				box.Text = ""
			end
		end)
		box.FocusLost:Connect(function(enterPressed, inputObject)
			forceReturnSelectionOnFocusLost = false
		end)
		if extraSpacing then
			box.Position = UDim2.new(box.Position.X.Scale,box.Position.X.Offset,
				box.Position.Y.Scale,box.Position.Y.Offset + extraSpacing)
		end

		ValueChangerSelection.SelectionGained:Connect(function()
			if usesSelectedObject() then
				box.BackgroundTransparency = 0.1

				if ValueChangerInstance.HubRef then
					ValueChangerInstance.HubRef:ScrollToFrame(ValueChangerSelection)
				end
			end
		end)
		ValueChangerSelection.SelectionLost:Connect(function()
			if usesSelectedObject() then
				box.BackgroundTransparency = 0.5
			end
		end)

		local setRowSelection = function()
			local fullscreenDropDown = CoreGui.RobloxGui:FindFirstChild("DropDownFullscreenFrame")
			if fullscreenDropDown and fullscreenDropDown.Visible then return end

			local valueFrame = ValueChangerSelection

			if valueFrame and valueFrame.Visible and valueFrame.ZIndex > 1 and usesSelectedObject() and pageToAddTo.Active then
				GuiService.SelectedCoreObject = valueFrame
				isMouseOverRow = true
			end
		end
		local function processInput(input)
			if input.UserInputState == Enum.UserInputState.Begin then
				if input.KeyCode == Enum.KeyCode.Return then
					if GuiService.SelectedCoreObject == ValueChangerSelection then
						forceReturnSelectionOnFocusLost = true
						box:CaptureFocus()
					end
				end
			end
		end
		box.MouseEnter:Connect(setRowSelection)

		UserInputService.InputBegan:Connect(processInput)

	elseif selectionType == "TextEntry" then
		local isMouseOverRow = false
		local forceReturnSelectionOnFocusLost = false
		local SelectionOverrideObject = Util.Create'ImageLabel'
		{
			Image = "",
			BackgroundTransparency = 1,
		};

		ValueChangerInstance = {}
		ValueChangerInstance.HubRef = nil

		local box = Util.Create'TextBox'
		{
			AnchorPoint = Vector2.new(1, 0.5),
			Size = UDim2.new(0.4,-10,0,40),
			Position = UDim2.new(1,0,0.5,0),
			Text = rowDisplayName,
			TextColor3 = Color3.fromRGB(178, 178, 178),
			BackgroundTransparency = 1.0,
			BorderSizePixel = 0,
			TextYAlignment = Enum.TextYAlignment.Center,
			TextXAlignment = Enum.TextXAlignment.Center,
			TextWrapped = false,
			Font = Enum.Font.SourceSans,
			TextSize = 24,
			ZIndex = 2,
			SelectionImageObject = SelectionOverrideObject,
			ClearTextOnFocus = false,
			Parent = RowFrame
		};
		ValueChangerSelection = box

		box.Focused:Connect(function()
			if usesSelectedObject() then
				GuiService.SelectedCoreObject = box
			end

			if box.Text == rowDisplayName then
				box.Text = ""
			end
		end)
		box.FocusLost:Connect(function(enterPressed, inputObject)
			forceReturnSelectionOnFocusLost = false
		end)
		if extraSpacing then
			box.Position = UDim2.new(box.Position.X.Scale,box.Position.X.Offset,
										box.Position.Y.Scale,box.Position.Y.Offset + extraSpacing)
		end

		ValueChangerSelection.SelectionGained:Connect(function()
			if usesSelectedObject() then
				box.BackgroundTransparency = 0.8

				if ValueChangerInstance.HubRef then
					ValueChangerInstance.HubRef:ScrollToFrame(ValueChangerSelection)
				end
			end
		end)
		ValueChangerSelection.SelectionLost:Connect(function()
			if usesSelectedObject() then
				box.BackgroundTransparency = 1.0
			end
		end)

		local setRowSelection = function()
			local fullscreenDropDown = CoreGui.RobloxGui:FindFirstChild("DropDownFullscreenFrame")
			if fullscreenDropDown and fullscreenDropDown.Visible then return end

			local valueFrame = ValueChangerSelection

			if valueFrame and valueFrame.Visible and valueFrame.ZIndex > 1 and usesSelectedObject() and pageToAddTo.Active then
				GuiService.SelectedCoreObject = valueFrame
				isMouseOverRow = true
			end
		end
		local function processInput(input)
			if input.UserInputState == Enum.UserInputState.Begin then
				if input.KeyCode == Enum.KeyCode.Return then
					if GuiService.SelectedCoreObject == ValueChangerSelection then
						forceReturnSelectionOnFocusLost = true
						box:CaptureFocus()
					end
				end
			end
		end
		RowFrame.MouseEnter:Connect(setRowSelection)

		function ValueChangerInstance:SetZIndex(newZIndex)
			box.ZIndex = newZIndex
		end

		function ValueChangerInstance:SetInteractable(interactable)
			box.Selectable = interactable
			if not interactable then
				box.TextColor3 = Color3.fromRGB(49,49,49)
				box.ZIndex = 1
			else
				box.TextColor3 = Color3.fromRGB(178,178,178)
				box.ZIndex = 2
			end
		end

		function ValueChangerInstance:SetValue(value) -- should this do more?
			box.Text = value
		end

		local valueChangedEvent = Instance.new("BindableEvent")
		valueChangedEvent.Name = "ValueChanged"

		box.FocusLost:Connect(function()
			valueChangedEvent:Fire(box.Text)
		end)

		ValueChangerInstance.ValueChanged = valueChangedEvent.Event

		UserInputService.InputBegan:Connect(processInput)
	end

	ValueChangerInstance.Name = rowDisplayName .. "ValueChanger"

	nextRowPositionY = nextRowPositionY + ROW_HEIGHT
	if extraSpacing then
		nextRowPositionY = nextRowPositionY + extraSpacing
	end

	nextPosTable[pageToAddTo] = nextRowPositionY

	if isARealRow then
		local setRowSelection = function()
			local fullscreenDropDown = CoreGui.RobloxGui:FindFirstChild("DropDownFullscreenFrame")
			if fullscreenDropDown and fullscreenDropDown.Visible then return end

			local valueFrame = ValueChangerInstance.SliderFrame
			if not valueFrame then
				valueFrame = ValueChangerInstance.SliderFrame
			end
			if not valueFrame then
				valueFrame = ValueChangerInstance.DropDownFrame
			end
			if not valueFrame then
				valueFrame = ValueChangerInstance.SelectorFrame
			end

			if valueFrame and valueFrame.Visible and valueFrame.ZIndex > 1 and usesSelectedObject() and pageToAddTo.Active then
				GuiService.SelectedCoreObject = valueFrame
			end
		end
		RowFrame.MouseEnter:Connect(setRowSelection)

		--Could this be cleaned up even more?
		local function onVREnabled(prop)
			if prop == "VREnabled" then
				if VRService.VREnabled then
					RowFrame.Selectable = true
					RowFrame.Active = true
					ValueChangerSelection.Active = true
					GuiService.Changed:Connect(function(prop)
						if prop == "SelectedCoreObject" then
							local selected = GuiService.SelectedCoreObject
							if selected and (selected == RowFrame or selected:IsDescendantOf(RowFrame)) then
								RowFrame.ImageTransparency = 0.5
								RowFrame.BackgroundTransparency = 1
							else
								RowFrame.ImageTransparency = 1
								RowFrame.BackgroundTransparency = 1
							end
						end
					end)
				else
					RowFrame.Selectable = false
					RowFrame.Active = false
				end
			end
		end
		VRService.Changed:Connect(onVREnabled)
		onVREnabled("VREnabled")

		ValueChangerSelection.SelectionGained:Connect(function()
			if usesSelectedObject() then
				if VRService.VREnabled then
					RowFrame.ImageTransparency = 0.5
					RowFrame.BackgroundTransparency = 1
				else
					RowFrame.ImageTransparency = 1
					RowFrame.BackgroundTransparency = 0.5
				end

				if ValueChangerInstance.HubRef then
					ValueChangerInstance.HubRef:ScrollToFrame(RowFrame)
				end
			end
		end)
		ValueChangerSelection.SelectionLost:Connect(function()
			if usesSelectedObject() then
				RowFrame.ImageTransparency = 1
				RowFrame.BackgroundTransparency = 1
			end
		end)
	end

	pageToAddTo:AddRow(RowFrame, RowLabel, ValueChangerInstance, extraSpacing, false)

	ValueChangerInstance.Selection = ValueChangerSelection

	return RowFrame, RowLabel, ValueChangerInstance
end

local function AddNewRowObject(pageToAddTo, rowDisplayName, rowObject, extraSpacing)
	local nextRowPositionY = 0

	if nextPosTable[pageToAddTo] then
		nextRowPositionY = nextPosTable[pageToAddTo]
	end

	local RowFrame = Util.Create'ImageButton'
	{
		Name = rowDisplayName .. "Frame",
		BackgroundTransparency = 1,
		BorderSizePixel = 0,
		Image = "rbxasset://textures/ui/VR/rectBackgroundWhite.png",
		ScaleType = Enum.ScaleType.Slice,
		SliceCenter = Rect.new(10,10,10,10),
		ImageTransparency = 1,
		Active = false,
		AutoButtonColor = false,
		Size = UDim2.new(1,0,0,ROW_HEIGHT),
		Position = UDim2.new(0,0,0,nextRowPositionY),
		ZIndex = 2,
		Selectable = false,
		SelectionImageObject = noSelectionObject,
		Parent = pageToAddTo.Page
	};
	RowFrame.ImageColor3 = RowFrame.BackgroundColor3
	RowFrame.SelectionGained:Connect(function()
		RowFrame.BackgroundTransparency = 0.5
	end)
	RowFrame.SelectionLost:Connect(function()
		RowFrame.BackgroundTransparency = 1
	end)

	local RowLabel = Util.Create'TextLabel'
	{
		Name = rowDisplayName .. "Label",
		Text = rowDisplayName,
		Font = Enum.Font.SourceSansBold,
		TextSize = 16,
		TextColor3 = Color3.fromRGB(255,255,255),
		TextXAlignment = Enum.TextXAlignment.Left,
		BackgroundTransparency = 1,
		Size = UDim2.new(0,200,1,0),
		Position = UDim2.new(0,10,0,0),
		ZIndex = 2,
		Parent = RowFrame
	};
	local function onResized(viewportSize, portrait)
		if portrait then
			RowLabel.TextSize = 16
		else
			RowLabel.TextSize = isTenFootInterface() and 36 or 24
		end
	end
	addOnResizedCallback(RowFrame, onResized)

	if extraSpacing then
		RowFrame.Position = UDim2.new(RowFrame.Position.X.Scale,RowFrame.Position.X.Offset,
			RowFrame.Position.Y.Scale,RowFrame.Position.Y.Offset + extraSpacing)
	end

	nextRowPositionY = nextRowPositionY + ROW_HEIGHT
	if extraSpacing then
		nextRowPositionY = nextRowPositionY + extraSpacing
	end

	nextPosTable[pageToAddTo] = nextRowPositionY

	local setRowSelection = function()
		if RowFrame.Visible then
			GuiService.SelectedCoreObject = RowFrame
		end
	end
	RowFrame.MouseEnter:Connect(setRowSelection)

	rowObject.SelectionImageObject = noSelectionObject

	rowObject.SelectionGained:Connect(function()
		if VRService.VREnabled then
			RowFrame.ImageTransparency = 0.5
			RowFrame.BackgroundTransparency = 1
		else
			RowFrame.ImageTransparency = 1
			RowFrame.BackgroundTransparency = 0.5
		end
	end)
	rowObject.SelectionLost:Connect(function()
		RowFrame.ImageTransparency = 1
		RowFrame.BackgroundTransparency = 1
	end)

	rowObject.Parent = RowFrame

	pageToAddTo:AddRow(RowFrame, RowLabel, rowObject, extraSpacing, true)
	return RowFrame
end
