local a=35 local d=game:GetService("\080\108\097\121\101\114\115")local T=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local j=require(((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\080\114\111\106\101\099\116")):WaitForChild("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101"))local D=j:GetResource("\069\120\116\101\114\110\097\108\085\116\105\108\046\078\101\120\117\115\073\110\115\116\097\110\099\101\046\078\101\120\117\115\079\098\106\101\099\116")local p=j:GetResource("\071\097\109\101\068\097\116\097\046\073\116\101\109\046\073\116\101\109\115")local X=j:GetResource("\085\073\046\066\117\116\116\111\110\046\073\109\097\103\101\069\118\101\110\116\066\105\110\100\101\114")local G=j:GetResource("\085\073\046\066\117\116\116\111\110\046\087\105\100\101\084\101\120\116\066\117\116\116\111\110\068\101\099\111\114\097\116\111\114")local B=j:GetResource("\085\073\046\073\116\101\109\073\099\111\110")local g=j:GetResource("\085\073\046\065\115\112\101\099\116\082\097\116\105\111\083\119\105\116\099\104\101\114")local m=j:GetResource("\083\116\097\116\101\046\068\105\115\112\108\097\121\079\114\100\101\114\067\111\110\116\114\111\108\108\101\114")local H=j:GetResource("\083\116\097\116\101\046\080\108\097\121\101\114\068\097\116\097")local V=j:GetResource("\083\116\097\116\101\046\073\110\118\101\110\116\111\114\121")local R=j:GetResource("\083\116\097\116\101\046\076\101\118\101\108\115")local x=require(script.Parent:WaitForChild("\080\108\097\121\101\114\068\105\115\112\108\097\121"))local u=require(script.Parent:WaitForChild("\080\101\116\068\105\115\112\108\097\121"))local K=j:GetResource("\071\097\109\101\082\101\112\108\105\099\097\116\105\111\110\046\073\110\118\101\110\116\111\114\121\082\101\112\108\105\099\097\116\105\111\110\046\083\119\097\112\083\108\111\116\115")local f=j:GetResource("\071\097\109\101\082\101\112\108\105\099\097\116\105\111\110\046\073\110\118\101\110\116\111\114\121\082\101\112\108\105\099\097\116\105\111\110\046\083\101\116\080\101\116")local k=j:GetResource("\071\097\109\101\082\101\112\108\105\099\097\116\105\111\110\046\073\110\118\101\110\116\111\114\121\082\101\112\108\105\099\097\116\105\111\110\046\068\101\108\101\116\101\073\116\101\109")local Y=D:Extend()Y:SetClassName("\073\110\118\101\110\116\111\114\121\087\105\110\100\111\119")function Y.__new(T)T:InitializeSuper()T.Inventory=V.GetInventory(d.LocalPlayer)T.PlayerData=H.GetPlayerData(d.LocalPlayer)local j=Instance.new("\083\099\114\101\101\110\071\117\105")j.Name="\073\110\118\101\110\116\111\114\121"j.Parent=script.Parent.Parent T.InventoryScreenGui=j local D=Instance.new("\073\109\097\103\101\076\097\098\101\108")D.BackgroundTransparency=1 D.Position=UDim2.new(.5,0,1.5,0)D.AnchorPoint=Vector2.new(.5,.5)D.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\054\049\056\054\056"D.Parent=j local p=Instance.new("\070\114\097\109\101")p.BackgroundTransparency=1 p.Size=UDim2.new(1,0,1,0)p.Parent=D local G=Instance.new("\070\114\097\109\101")G.BackgroundTransparency=1 G.Size=UDim2.new(1,0,1,0)G.Visible=false G.Parent=D g.new(j,1.4,function()D.Size=UDim2.new(1.26,0,.9,0)D.SizeConstraint=Enum.SizeConstraint.RelativeYY end,function()D.Size=UDim2.new(.9,0,.64285714285714,0)D.SizeConstraint=Enum.SizeConstraint.RelativeXX end)local K=Instance.new("\073\109\097\103\101\076\097\098\101\108")K.BackgroundTransparency=1 K.AnchorPoint=Vector2.new(1,0)K.Size=UDim2.new(.065,0,.065,0)K.SizeConstraint=Enum.SizeConstraint.RelativeYY K.Position=UDim2.new(1,0,0,0)K.Parent=D local f=X.new(K,UDim2.new(1,0,1,0),"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\051\048\050\052\056\056","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\051\048\050\052\051\056","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\051\048\050\052\054\053")local k=Instance.new("\073\109\097\103\101\076\097\098\101\108")k.BackgroundTransparency=1 k.Size=UDim2.new(.23059866962306,0,.096273291925466,0)k.Position=UDim2.new(.049889135254989,0,.046583850931677,0)k.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\053\053\053\056\050\054\050\050\054\051"k.Parent=p local Y=R.GetLevels(d.LocalPlayer)local r=Instance.new("\084\101\120\116\076\097\098\101\108")r.BackgroundTransparency=1 r.Size=UDim2.new(.8,0,.8,0)r.Position=UDim2.new(.1,0,.025,0)r.Font=Enum.Font.Antique r.Text="\076\101\118\101\108 "..tostring(Y.Level)r.TextColor3=Color3.new(.15686274509804,.15686274509804,.15686274509804)r.TextScaled=true r.Parent=k;(Y:GetPropertyChangedSignal("\076\101\118\101\108")):Connect(function()r.Text="\076\101\118\101\108 "..tostring(Y.Level)end)local i=Instance.new("\073\109\097\103\101\076\097\098\101\108")i.BackgroundTransparency=1 i.Size=UDim2.new(.4290465631929,0,.080745341614907,0)i.Position=UDim2.new(.048780487804878,0,.83229813664596,0)i.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\054\050\048\051\050"i.Parent=D local S=Instance.new("\084\101\120\116\076\097\098\101\108")S.BackgroundTransparency=1 S.Size=UDim2.new(.8,0,.8,0)S.Position=UDim2.new(.1,0,.025,0)S.Font=Enum.Font.Antique S.Text=d.LocalPlayer.Name S.TextColor3=Color3.new(.15686274509804,.15686274509804,.15686274509804)S.TextScaled=true S.Parent=i local z=Instance.new("\073\109\097\103\101\076\097\098\101\108")z.BackgroundTransparency=1 z.Size=UDim2.new(.070953436807095,0,.099378881987578,0)z.Position=UDim2.new(.048780487804878,0,.25465838509317,0)z.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\057\048\054\056\050"z.ZIndex=4 z.Parent=D local q=Instance.new("\073\109\097\103\101\076\097\098\101\108")q.BackgroundTransparency=1 q.Size=UDim2.new(.070953436807095,0,.099378881987578,0)q.Position=UDim2.new(.40909090909091,0,.40062111801242,0)q.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\054\050\049\051\048"q.ZIndex=4 q.Parent=D local I=Instance.new("\073\109\097\103\101\076\097\098\101\108")I.BackgroundTransparency=1 I.Size=UDim2.new(.070953436807095,0,.099378881987578,0)I.Position=UDim2.new(.048780487804878,0,.55590062111801,0)I.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\056\057\054\050\053"I.ZIndex=4 I.Parent=D local Z=Instance.new("\073\109\097\103\101\076\097\098\101\108")Z.BackgroundTransparency=1 Z.Size=UDim2.new(.070953436807095,0,.099378881987578,0)Z.Position=UDim2.new(.048780487804878,0,.67391304347826,0)Z.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\057\048\055\050\057"Z.ZIndex=4 Z.Parent=D local F=Instance.new("\073\109\097\103\101\076\097\098\101\108")F.BackgroundTransparency=1 F.Size=UDim2.new(.070953436807095,0,.099378881987578,0)F.Position=UDim2.new(.40909090909091,0,.55590062111801,0)F.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\057\048\054\057\056"F.ZIndex=4 F.Parent=D local C=Instance.new("\073\109\097\103\101\076\097\098\101\108")C.BackgroundTransparency=1 C.Size=UDim2.new(.070953436807095,0,.099378881987578,0)C.Position=UDim2.new(.40909090909091,0,.67391304347826,0)C.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\057\048\055\049\055"C.ZIndex=4 C.Parent=D local A=Instance.new("\073\109\097\103\101\076\097\098\101\108")A.BackgroundTransparency=1 A.Size=UDim2.new(.070953436807095,0,.099378881987578,0)A.Position=UDim2.new(.18625277161863,0,.67391304347826,0)A.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\053\054\053\053\054\048\053\054\056\051"A.ZIndex=4 A.Parent=D local n=B.new()n:SetParent(A)n:SetItem("\077\097\112\069\121\101\066\097\099\107\066\114\111\119\110")T.EyeBackgroundItemFrame=n local Q=Instance.new("\073\109\097\103\101\076\097\098\101\108")Q.BackgroundTransparency=1 Q.Size=UDim2.new(.070953436807095,0,.099378881987578,0)Q.Position=UDim2.new(.27050997782705,0,.67391304347826,0)Q.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\053\054\053\053\054\048\053\054\056\051"Q.ZIndex=4 Q.Parent=D local e=B.new()e:SetParent(Q)e:SetItem("\077\097\112\069\121\101\070\114\111\110\116\068\101\102\097\117\108\116")T.EyeFrontItemFrame=e local v=Instance.new("\070\114\097\109\101")v.BackgroundTransparency=1 v.Size=UDim2.new(.6,0,.6,0)v.Position=UDim2.new(.05,0,.2,0)v.SizeConstraint="\082\101\108\097\116\105\118\101\089\089"v.Parent=D T.PlayerDisplay=x.new(v)local c=Instance.new("\073\109\097\103\101\076\097\098\101\108")c.BackgroundTransparency=1 c.Size=UDim2.new(.4290465631929,0,.11180124223602,0)c.Position=UDim2.new(.044345898004435,0,.043478260869565,0)c.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\055\051\056\049\054"c.Visible=false c.Parent=D local b=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")b.BackgroundTransparency=1 b.AnchorPoint=Vector2.new(.5,.5)b.Size=UDim2.new(.13953488372093,0,.76388888888889,0)b.Position=UDim2.new(.13953488372093,0,.5,0)b.Parent=c local y=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")y.BackgroundTransparency=1 y.AnchorPoint=Vector2.new(.5,.5)y.Size=UDim2.new(.13953488372093,0,.76388888888889,0)y.Position=UDim2.new(.28682170542636,0,.5,0)y.Parent=c local J=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")J.BackgroundTransparency=1 J.AnchorPoint=Vector2.new(.5,.5)J.Size=UDim2.new(.13953488372093,0,.76388888888889,0)J.Position=UDim2.new(.43410852713178,0,.5,0)J.Parent=c local l=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")l.BackgroundTransparency=1 l.AnchorPoint=Vector2.new(.5,.5)l.Size=UDim2.new(.13953488372093,0,.76388888888889,0)l.Position=UDim2.new(.58139534883721,0,.5,0)l.Parent=c local O=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")O.BackgroundTransparency=1 O.AnchorPoint=Vector2.new(.5,.5)O.Size=UDim2.new(.13953488372093,0,.76388888888889,0)O.Position=UDim2.new(.72093023255814,0,.5,0)O.Parent=c local s=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")s.BackgroundTransparency=1 s.AnchorPoint=Vector2.new(.5,.5)s.Size=UDim2.new(.13953488372093,0,.76388888888889,0)s.Position=UDim2.new(.86821705426357,0,.5,0)s.Parent=c T.PetToggleButtons={Dog={b;"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\052\057\056\048","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\052\057\052\048";"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\052\057\054\054"},Cat={y,"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\052\056\048\048","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\052\056\048\048";"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\052\055\054\056"};Pig={J,"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\053\050\051\050","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\053\049\056\051";"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\053\050\048\056"},Horse={l;"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\053\055\053\049";"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\053\054\056\048";"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\053\055\050\049"},Panda={O;"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\053\049\051\048";"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\053\048\055\053";"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\053\048\057\056"},Dragon={s,"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\053\048\053\049";"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\052\057\057\053";"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\053\048\049\056"}}local t=true for a,d in pairs(T.PetToggleButtons)do d[1].Image=d[2]d[1].MouseEnter:Connect(function()if T.PlayerData:GetValue("\067\117\114\114\101\110\116\080\101\116")~=a then d[1].Image=d[3]end end)d[1].MouseLeave:Connect(function()if T.PlayerData:GetValue("\067\117\114\114\101\110\116\080\101\116")~=a then d[1].Image=d[2]end end)d[1].MouseButton1Down:Connect(function()if t then t=false T:SetPet(a)wait()t=true end end)end local W=Instance.new("\073\109\097\103\101\076\097\098\101\108")W.BackgroundTransparency=1 W.Size=UDim2.new(.070953436807095,0,.099378881987578,0)W.Position=UDim2.new(.40909090909091,0,.31987577639752,0)W.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\057\048\054\056\050"W.Visible=false W.ZIndex=3 W.Parent=D local M=Instance.new("\073\109\097\103\101\076\097\098\101\108")M.BackgroundTransparency=1 M.Size=UDim2.new(.070953436807095,0,.099378881987578,0)M.Position=UDim2.new(.40909090909091,0,.43788819875776,0)M.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\053\050\056\053\051\051"M.Visible=false M.ZIndex=3 M.Parent=D local U=Instance.new("\073\109\097\103\101\076\097\098\101\108")U.BackgroundTransparency=1 U.Size=UDim2.new(.070953436807095,0,.099378881987578,0)U.Position=UDim2.new(.40909090909091,0,.55590062111801,0)U.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\053\050\056\052\057\052"U.Visible=false U.ZIndex=3 U.Parent=D local P=Instance.new("\073\109\097\103\101\076\097\098\101\108")P.BackgroundTransparency=1 P.Size=UDim2.new(.070953436807095,0,.099378881987578,0)P.Position=UDim2.new(.40909090909091,0,.67391304347826,0)P.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\053\050\056\053\052\051"P.Visible=false P.ZIndex=3 P.Parent=D local L=Instance.new("\070\114\097\109\101")L.BackgroundTransparency=1 L.Size=UDim2.new(.6,0,.6,0)L.Position=UDim2.new(.05,0,.2,0)L.SizeConstraint="\082\101\108\097\116\105\118\101\089\089"L.Visible=false L.Parent=D T.PetDisplay=u.new(L)local o=Instance.new("\073\109\097\103\101\076\097\098\101\108")o.BackgroundTransparency=1 o.Size=UDim2.new(.11973392461197,0,.1723602484472,0)o.Position=UDim2.new(.37915742793792,0,.16149068322981,0)o.ZIndex=4 o.Parent=D local w=X.new(o,UDim2.new(1,0,1,0),"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\052\057\056\048","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\052\057\052\048","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\048\054\052\057\054\054")local h=Instance.new("\073\109\097\103\101\076\097\098\101\108")h.BackgroundTransparency=1 h.Size=UDim2.new(.26607538802661,0,.093167701863354,0)h.Position=UDim2.new(.2549889135255,0,.1583850931677,0)h.Visible=false h.Parent=D local E=X.new(h,UDim2.new(.8,0,.8,0),"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\053\050\056\052\051\049","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\053\050\056\052\051\049","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\053\050\056\052\050\048")w.Button.MouseButton1Down:Connect(function()if t then t=false o.Visible=false k.Visible=false z.Visible=false q.Visible=false I.Visible=false Z.Visible=false F.Visible=false C.Visible=false A.Visible=false Q.Visible=false v.Visible=false h.Visible=true c.Visible=true W.Visible=true M.Visible=true U.Visible=true P.Visible=true L.Visible=true wait()t=true end end)E.Button.MouseButton1Down:Connect(function()if t then t=false o.Visible=true k.Visible=true z.Visible=true q.Visible=true I.Visible=true Z.Visible=true F.Visible=true C.Visible=true v.Visible=true A.Visible=true Q.Visible=true h.Visible=false c.Visible=false W.Visible=false M.Visible=false U.Visible=false P.Visible=false L.Visible=false wait()t=true end end)local N=Instance.new("\073\109\097\103\101\076\097\098\101\108")N.BackgroundTransparency=1 N.Size=UDim2.new(.36474501108647,0,.86645962732919,0)N.Position=UDim2.new(.54878048780488,0,.046583850931677,0)N.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\053\048\051\050\052\048"N.Parent=D local aX=Instance.new("\073\109\097\103\101\076\097\098\101\108")aX.BackgroundTransparency=1 aX.AnchorPoint=Vector2.new(.5,0)aX.Size=UDim2.new(1.0425531914894,0,.84408602150538,0)aX.Position=UDim2.new(.49544072948328,0,.062724014336918,0)aX.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\053\048\050\056\051\054"aX.ZIndex=5 aX.Parent=N local dX=Instance.new("\073\109\097\103\101\076\097\098\101\108")dX.BackgroundTransparency=1 dX.AnchorPoint=Vector2.new(.5,.5)dX.Size=UDim2.new(.11854103343465,0,.050179211469534,0)dX.Position=UDim2.new(.19148936170213,0,.94444444444444,0)dX.Parent=N T.InventoryLeftImage=dX local TX=X.new(dX,UDim2.new(1,0,1,0),"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\054\050\052\054\052","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\054\050\052\051\051","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\054\050\052\052\055")local jX=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")jX.BackgroundTransparency=1 jX.AnchorPoint=Vector2.new(.5,.5)jX.Size=UDim2.new(.11854103343465,0,.050179211469534,0)jX.Position=UDim2.new(.79939209726444,0,.94444444444444,0)jX.Parent=N T.InventoryRightImage=jX local DX=X.new(jX,UDim2.new(1,0,1,0),"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\054\050\053\049\056","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\054\050\053\048\051","\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\052\054\050\053\049\053")local pX=Instance.new("\084\101\120\116\076\097\098\101\108")pX.BackgroundTransparency=1 pX.Size=UDim2.new(.10030395136778,0,.089605734767025,0)pX.Position=UDim2.new(.56534954407295,0,.88530465949821,0)pX.Font=Enum.Font.Antique pX.Text="\049"pX.TextColor3=Color3.new(.93333333333333,.80392156862745,1.0)pX.TextScaled=true pX.Parent=N T.PageText=pX local XX=Instance.new("\073\109\097\103\101\076\097\098\101\108")XX.BackgroundTransparency=1 XX.AnchorPoint=Vector2.new(1,1)XX.Size=UDim2.new(.070953436807095,0,.099378881987578,0)XX.Position=UDim2.new(.97117516629712,0,.94254658385093,0)XX.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\053\054\053\053\054\048\053\054\056\051"XX.ZIndex=4 XX.Parent=D T.InventorySlotFrames={}T.InventorySlotIcons={}for a=1,a,1 do local d=Instance.new("\070\114\097\109\101")d.BackgroundTransparency=1 d.Size=UDim2.new(.19452887537994,0,.11469534050179,0)d.Position=UDim2.new((2+65*((a-1)%5))/329,0,(43+65*math.floor((a-1)/5))/558,0)d.Parent=N table.insert(T.InventorySlotFrames,d)local j=B.new()j:SetParent(d)table.insert(T.InventorySlotIcons,j)end T.SpecialInventorySlots={PlayerHat=z,PlayerTorso=q;PlayerLeftArm=F;PlayerRightArm=I;PlayerLeftLeg=C;PlayerRightLeg=Z,MapEyeBack=A;MapEyeFront=Q;PetCostumeHat=W,PetCostumeCollar=M;PetCostumeBack=U;PetCostumeAnkle=P;Trash=XX}T.SpecialInventoryIcons={}for a,d in pairs(T.SpecialInventorySlots)do local j=B.new()j:SetParent(d)T.SpecialInventoryIcons[a]=j end T.CurrentPage=1 T.MaxPages=3 TX.Button.MouseButton1Down:Connect(function()if t then t=false T.CurrentPage=math.max(1,T.CurrentPage-1)T:UpdateInventory()wait()t=true end end)DX.Button.MouseButton1Down:Connect(function()if t then t=false T.CurrentPage=math.min(T.MaxPages,T.CurrentPage+1)T:UpdateInventory()wait()t=true end end)T.Inventory.InventoryChanged:Connect(function()T:UpdateInventory()end);(T.PlayerData:GetValueChangedSignal("\080\101\116\115\079\119\110\101\100")):Connect(function()T:UpdateInventory()end);(T.PlayerData:GetValueChangedSignal("\067\117\114\114\101\110\116\080\101\116")):Connect(function()T:UpdateInventory()end)T:UpdateInventory()local GX=(script.Parent.Parent:WaitForChild("\071\117\105\079\112\101\110\083\116\097\116\101\115")):WaitForChild("\073\110\118\101\110\116\111\114\121")m:Register(j,GX)T.OpenValue=GX GX.Changed:Connect(function()D:TweenPosition(UDim2.new(.5,0,GX.Value and.5 or 1.5,0),"\079\117\116","\081\117\097\100",.5,true)end)f.Button.MouseButton1Down:Connect(function()D:TweenPosition(UDim2.new(.5,0,1.5,0),"\079\117\116","\081\117\097\100",.5,true)GX.Value=false end)T:SetUpDraggning()end function Y.PointInFrame(j,a,d,T)local D,p=T.AbsoluteSize,T.AbsolutePosition return T.Visible and(a>=p.X and(a<=p.X+D.X and(d>=p.Y and d<=p.Y+D.Y)))end function Y.SetUpDraggning(d)local j,D,X local G,g T.InputBegan:Connect(function(T,m)if m or T.UserInputType~=Enum.UserInputType.MouseButton1 and T.UserInputType~=Enum.UserInputType.Touch then return end if not d.OpenValue.Value then return end if D then D:Destroy()D=nil X:Destroy()end local H,V for a,j in pairs(d.SpecialInventorySlots)do if d:PointInFrame(T.Position.X,T.Position.Y,j)then H=a V=j break end end if not H then for j,D in pairs(d.InventorySlotFrames)do if d:PointInFrame(T.Position.X,T.Position.Y,D)then H=j+(d.CurrentPage-1)*a V=D break end end end if not H then return end local R=d.Inventory:GetItem(H)if not R or not R.Name then return end local x=p[R.Name]if x and x.CanDragCallback then if not x.CanDragCallback(d.Inventory,H)then return end end j=H G=V.AbsolutePosition.X-T.Position.X g=V.AbsolutePosition.Y-T.Position.Y D=Instance.new("\070\114\097\109\101")D.BackgroundTransparency=1 D.Size=UDim2.new(0,V.AbsoluteSize.X,0,V.AbsoluteSize.Y)D.Position=UDim2.new(0,V.AbsolutePosition.X,0,V.AbsolutePosition.Y)D.ZIndex=20 D.Parent=d.InventoryScreenGui X=B.new()X:SetParent(D)X:SetItem(R.Name)for a,d in pairs(d.SpecialInventoryIcons)do if a==H then d.ViewportFrame.Visible=false break end end if type(H)=="\110\117\109\098\101\114"then for d,T in pairs(d.InventorySlotIcons)do if d==(H-1)%a+1 then T.ViewportFrame.Visible=false break end end end end)T.InputChanged:Connect(function(a)if a.UserInputType~=Enum.UserInputType.MouseMovement and a.UserInputType~=Enum.UserInputType.Touch then return end if D then D.Position=UDim2.new(0,a.Position.X+G,0,a.Position.Y+g)end end)T.InputEnded:Connect(function(T)if T.UserInputType~=Enum.UserInputType.MouseButton1 and T.UserInputType~=Enum.UserInputType.Touch then return end if not D then return end local p for a,j in pairs(d.SpecialInventorySlots)do if d:PointInFrame(T.Position.X,T.Position.Y,j)then p=a break end end if not p then for j,D in pairs(d.InventorySlotFrames)do if d:PointInFrame(T.Position.X,T.Position.Y,D)then p=j+(d.CurrentPage-1)*a break end end end if p and d.Inventory:CanSwap(j,p)then d.Inventory:SwapSlots(j,p)K:FireServer(j,p)end D:Destroy()D=nil X:Destroy()for a,d in pairs(d.SpecialInventoryIcons)do d.ViewportFrame.Visible=true end for a,d in pairs(d.InventorySlotIcons)do d.ViewportFrame.Visible=true end if p=="\084\114\097\115\104"then d:PromptDelete(j)end end)end function Y.UpdateInventory(d)d.MaxPages=d.Inventory:GetMaxItems()/a d.InventoryLeftImage.Visible=d.CurrentPage~=1 d.InventoryRightImage.Visible=d.CurrentPage~=d.MaxPages d.PageText.Text=tostring(d.CurrentPage)local T=a*(d.CurrentPage-1)for a=1,a,1 do local j=d.Inventory:GetItem(a+T)local D=d.InventorySlotIcons[a]if j then D:SetItem(j.Name)else D:SetItem()end end for a,T in pairs(d.SpecialInventoryIcons)do local j=d.Inventory:GetItem(a)if j then T:SetItem(j.Name)else T:SetItem()end end local j=d.PlayerData:GetValue("\067\117\114\114\101\110\116\080\101\116")local D=d.PlayerData:GetValue("\080\101\116\115\079\119\110\101\100")for a,d in pairs(d.PetToggleButtons)do d[1].Visible=a=="\068\111\103"or D[a]==true if a==j then d[1].Image=d[4]else if d[1].Image==d[4]then d[1].Image=d[2]end end end d.PlayerDisplay:SetHat(d.Inventory:GetItem("\080\108\097\121\101\114\072\097\116"))d.PlayerDisplay:SetItem("\084\111\114\115\111",d.Inventory:GetItem("\080\108\097\121\101\114\084\111\114\115\111"))d.PlayerDisplay:SetItem("\076\101\102\116\065\114\109",d.Inventory:GetItem("\080\108\097\121\101\114\076\101\102\116\065\114\109"))d.PlayerDisplay:SetItem("\082\105\103\104\116\065\114\109",d.Inventory:GetItem("\080\108\097\121\101\114\082\105\103\104\116\065\114\109"))d.PlayerDisplay:SetItem("\076\101\102\116\076\101\103",d.Inventory:GetItem("\080\108\097\121\101\114\076\101\102\116\076\101\103"))d.PlayerDisplay:SetItem("\082\105\103\104\116\076\101\103",d.Inventory:GetItem("\080\108\097\121\101\114\082\105\103\104\116\076\101\103"))d.PetDisplay:SetItem("\080\101\116\067\111\115\116\117\109\101\072\097\116",d.Inventory:GetItem("\080\101\116\067\111\115\116\117\109\101\072\097\116"))d.PetDisplay:SetItem("\080\101\116\067\111\115\116\117\109\101\067\111\108\108\097\114",d.Inventory:GetItem("\080\101\116\067\111\115\116\117\109\101\067\111\108\108\097\114"))d.PetDisplay:SetItem("\080\101\116\067\111\115\116\117\109\101\066\097\099\107",d.Inventory:GetItem("\080\101\116\067\111\115\116\117\109\101\066\097\099\107"))d.PetDisplay:SetItem("\080\101\116\067\111\115\116\117\109\101\065\110\107\108\101",d.Inventory:GetItem("\080\101\116\067\111\115\116\117\109\101\065\110\107\108\101"))d.PetDisplay:SetPet(j)if d.Inventory:GetItem("\077\097\112\069\121\101\066\097\099\107")then d.EyeBackgroundItemFrame:SetItem()else d.EyeBackgroundItemFrame:SetItem("\077\097\112\069\121\101\066\097\099\107\066\114\111\119\110")end if d.Inventory:GetItem("\077\097\112\069\121\101\070\114\111\110\116")then d.EyeFrontItemFrame:SetItem()else d.EyeFrontItemFrame:SetItem("\077\097\112\069\121\101\070\114\111\110\116\068\101\102\097\117\108\116")end end function Y.SetPet(d,a)f:FireServer(a)d.PlayerData:SetValue("\067\117\114\114\101\110\116\080\101\116",a)end function Y.PromptDelete(d,a)local T=d.Inventory:GetItem(a)if not T then return end local j=p[T.Name]if not j then return end local D=Instance.new("\083\099\114\101\101\110\071\117\105")D.Name="\073\110\118\101\110\116\111\114\121"D.DisplayOrder=10 D.Parent=script.Parent.Parent local X=Instance.new("\073\109\097\103\101\076\097\098\101\108")X.BackgroundTransparency=1 X.AnchorPoint=Vector2.new(.5,.5)X.Size=UDim2.new(.54230769230769,0,.15,0)X.SizeConstraint=Enum.SizeConstraint.RelativeYY X.Position=UDim2.new(.5,0,-0.2,0)X.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\053\053\053\056\050\054\050\050\054\051"X.Parent=D X:TweenPosition(UDim2.new(.5,0,.5,0),"\079\117\116","\081\117\097\100",.5)local B=Instance.new("\084\101\120\116\076\097\098\101\108")B.BackgroundTransparency=1 B.Size=UDim2.new(.8,0,.3,0)B.Position=UDim2.new(.1,0,.15,0)B.Font=Enum.Font.Antique B.Text="\068\101\108\101\116\101 "..(j.DisplayName or tostring(T.Name))B.TextColor3=Color3.new(.15686274509804,.15686274509804,.15686274509804)B.TextScaled=true B.Parent=X local g=Instance.new("\073\109\097\103\101\076\097\098\101\108")g.BackgroundTransparency=1 g.AnchorPoint=Vector2.new(1,0)g.Size=UDim2.new(1.4461538461538,0,.4,0)g.SizeConstraint=Enum.SizeConstraint.RelativeYY g.Position=UDim2.new(.475,0,.45,0)g.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\053\053\053\056\050\054\050\050\054\051"g.Parent=X local m=G.new(g,"\089\101\115")local H=Instance.new("\073\109\097\103\101\076\097\098\101\108")H.BackgroundTransparency=1 H.Size=UDim2.new(1.4461538461538,0,.4,0)H.SizeConstraint=Enum.SizeConstraint.RelativeYY H.Position=UDim2.new(.525,0,.45,0)H.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\053\053\053\056\050\054\050\050\054\051"H.Parent=X local V=G.new(H,"\078\111")local R=true m.Button.MouseButton1Down:Connect(function()if R then R=false d.Inventory:RemoveSlot(a)k:FireServer(a)X:TweenPosition(UDim2.new(.5,0,-0.2,0),"\079\117\116","\081\117\097\100",.5,true,function()D:Destroy()end)end end)V.Button.MouseButton1Down:Connect(function()if R then R=false X:TweenPosition(UDim2.new(.5,0,-0.2,0),"\079\117\116","\081\117\097\100",.5,true,function()D:Destroy()end)end end)end return Y
--[[
TheNexusAvenger

Main window for the inventory.
--]]

local SLOTS_PER_PAGE = 35



local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")

local ReplicatedStorageProject = require(game:GetService("ReplicatedStorage"):WaitForChild("Project"):WaitForChild("ReplicatedStorage"))

local NexusObject = ReplicatedStorageProject:GetResource("ExternalUtil.NexusInstance.NexusObject")
local ItemData = ReplicatedStorageProject:GetResource("GameData.Item.Items")
local ImageEventBinder = ReplicatedStorageProject:GetResource("UI.Button.ImageEventBinder")
local WideTextButtonDecorator = ReplicatedStorageProject:GetResource("UI.Button.WideTextButtonDecorator")
local ItemIcon = ReplicatedStorageProject:GetResource("UI.ItemIcon")
local AspectRatioSwitcher = ReplicatedStorageProject:GetResource("UI.AspectRatioSwitcher")
local DisplayOrderController = ReplicatedStorageProject:GetResource("State.DisplayOrderController")
local PlayerData = ReplicatedStorageProject:GetResource("State.PlayerData")
local Inventory = ReplicatedStorageProject:GetResource("State.Inventory")
local Levels = ReplicatedStorageProject:GetResource("State.Levels")
local PlayerDisplay = require(script.Parent:WaitForChild("PlayerDisplay"))
local PetDisplay = require(script.Parent:WaitForChild("PetDisplay"))
local SwapSlots = ReplicatedStorageProject:GetResource("GameReplication.InventoryReplication.SwapSlots")
local SetPet = ReplicatedStorageProject:GetResource("GameReplication.InventoryReplication.SetPet")
local DeleteItem = ReplicatedStorageProject:GetResource("GameReplication.InventoryReplication.DeleteItem")

local InventoryWindow = NexusObject:Extend()
InventoryWindow:SetClassName("InventoryWindow")



--[[
Creates an inventory window.
--]]
function InventoryWindow:__new()
    self:InitializeSuper()

    --Create the window.
    self.Inventory = Inventory.GetInventory(Players.LocalPlayer)
    self.PlayerData = PlayerData.GetPlayerData(Players.LocalPlayer)
    local InventoryScreenGui = Instance.new("ScreenGui")
    InventoryScreenGui.Name = "Inventory"
    InventoryScreenGui.Parent = script.Parent.Parent
    self.InventoryScreenGui = InventoryScreenGui

    local Background = Instance.new("ImageLabel")
    Background.BackgroundTransparency = 1
    Background.Position = UDim2.new(0.5,0,1.5,0)
    Background.AnchorPoint = Vector2.new(0.5,0.5)
    Background.Image = "rbxassetid://131461868"
    Background.Parent = InventoryScreenGui

    local PlayerMenu = Instance.new("Frame")
    PlayerMenu.BackgroundTransparency = 1
    PlayerMenu.Size = UDim2.new(1,0,1,0)
    PlayerMenu.Parent = Background

    local PetMenu = Instance.new("Frame")
    PetMenu.BackgroundTransparency = 1
    PetMenu.Size = UDim2.new(1,0,1,0)
    PetMenu.Visible = false
    PetMenu.Parent = Background
    
    AspectRatioSwitcher.new(InventoryScreenGui,1.4,function()
        Background.Size = UDim2.new(0.9 * 1.4,0,0.9,0)
        Background.SizeConstraint = Enum.SizeConstraint.RelativeYY
    end,function()
        Background.Size = UDim2.new(0.9,0,0.9/1.4,0)
        Background.SizeConstraint = Enum.SizeConstraint.RelativeXX
    end)

    local InventoryCloseImage = Instance.new("ImageLabel")
    InventoryCloseImage.BackgroundTransparency = 1
    InventoryCloseImage.AnchorPoint = Vector2.new(1,0)
    InventoryCloseImage.Size = UDim2.new(0.065,0,0.065,0)
    InventoryCloseImage.SizeConstraint = Enum.SizeConstraint.RelativeYY
    InventoryCloseImage.Position = UDim2.new(1,0,0,0)
    InventoryCloseImage.Parent = Background
    local InventoryCloseButton = ImageEventBinder.new(InventoryCloseImage,UDim2.new(1,0,1,0),"rbxassetid://131302488","rbxassetid://131302438","rbxassetid://131302465")

    --Create the level indicator.
    local LevelBackground = Instance.new("ImageLabel")
    LevelBackground.BackgroundTransparency = 1
    LevelBackground.Size = UDim2.new(208/902,0,62/644,0)
    LevelBackground.Position = UDim2.new(45/902,0,30/644,0)
    LevelBackground.Image = "rbxassetid://5558262263"
    LevelBackground.Parent = PlayerMenu

    local PlayerLevels = Levels.GetLevels(Players.LocalPlayer)
    local LevelText = Instance.new("TextLabel")
    LevelText.BackgroundTransparency = 1
    LevelText.Size = UDim2.new(0.8,0,0.8,0)
    LevelText.Position = UDim2.new(0.1,0,0.025,0)
    LevelText.Font = Enum.Font.Antique
    LevelText.Text = "Level "..tostring(PlayerLevels.Level)
    LevelText.TextColor3 = Color3.new(40/255,40/255,40/255)
    LevelText.TextScaled = true
    LevelText.Parent = LevelBackground

    PlayerLevels:GetPropertyChangedSignal("Level"):Connect(function()
        LevelText.Text = "Level "..tostring(PlayerLevels.Level)
    end)

    --Create the username display.
    local UsernameBackground = Instance.new("ImageLabel")
    UsernameBackground.BackgroundTransparency = 1
    UsernameBackground.Size = UDim2.new(387/902,0,52/644,0)
    UsernameBackground.Position = UDim2.new(44/902,0,536/644,0)
    UsernameBackground.Image = "rbxassetid://131462032"
    UsernameBackground.Parent = Background

    local UsernameText = Instance.new("TextLabel")
    UsernameText.BackgroundTransparency = 1
    UsernameText.Size = UDim2.new(0.8,0,0.8,0)
    UsernameText.Position = UDim2.new(0.1,0,0.025,0)
    UsernameText.Font = Enum.Font.Antique
    UsernameText.Text = Players.LocalPlayer.Name
    UsernameText.TextColor3 = Color3.new(40/255,40/255,40/255)
    UsernameText.TextScaled = true
    UsernameText.Parent = UsernameBackground

    --Create the player inventory slots.
    local PlayerHeadSlot = Instance.new("ImageLabel")
    PlayerHeadSlot.BackgroundTransparency = 1
    PlayerHeadSlot.Size = UDim2.new(64/902,0,64/644,0)
    PlayerHeadSlot.Position = UDim2.new(44/902,0,164/644,0)
    PlayerHeadSlot.Image = "rbxassetid://131490682"
    PlayerHeadSlot.ZIndex = 4
    PlayerHeadSlot.Parent = Background
    
    local PlayerTorsoSlot = Instance.new("ImageLabel")
    PlayerTorsoSlot.BackgroundTransparency = 1
    PlayerTorsoSlot.Size = UDim2.new(64/902,0,64/644,0)
    PlayerTorsoSlot.Position = UDim2.new(369/902,0,258/644,0)
    PlayerTorsoSlot.Image = "rbxassetid://131462130"
    PlayerTorsoSlot.ZIndex = 4
    PlayerTorsoSlot.Parent = Background
    
    local PlayerRightArmSlot = Instance.new("ImageLabel")
    PlayerRightArmSlot.BackgroundTransparency = 1
    PlayerRightArmSlot.Size = UDim2.new(64/902,0,64/644,0)
    PlayerRightArmSlot.Position = UDim2.new(44/902,0,358/644,0)
    PlayerRightArmSlot.Image = "rbxassetid://131489625"
    PlayerRightArmSlot.ZIndex = 4
    PlayerRightArmSlot.Parent = Background
    
    local PlayerRightLegSlot = Instance.new("ImageLabel")
    PlayerRightLegSlot.BackgroundTransparency = 1
    PlayerRightLegSlot.Size = UDim2.new(64/902,0,64/644,0)
    PlayerRightLegSlot.Position = UDim2.new(44/902,0,434/644,0)
    PlayerRightLegSlot.Image = "rbxassetid://131490729"
    PlayerRightLegSlot.ZIndex = 4
    PlayerRightLegSlot.Parent = Background
    
    local PlayerLeftArmSlot = Instance.new("ImageLabel")
    PlayerLeftArmSlot.BackgroundTransparency = 1
    PlayerLeftArmSlot.Size = UDim2.new(64/902,0,64/644,0)
    PlayerLeftArmSlot.Position = UDim2.new(369/902,0,358/644,0)
    PlayerLeftArmSlot.Image = "rbxassetid://131490698"
    PlayerLeftArmSlot.ZIndex = 4
    PlayerLeftArmSlot.Parent = Background
    
    local PlayerLeftLegSlot = Instance.new("ImageLabel")
    PlayerLeftLegSlot.BackgroundTransparency = 1
    PlayerLeftLegSlot.Size = UDim2.new(64/902,0,64/644,0)
    PlayerLeftLegSlot.Position = UDim2.new(369/902,0,434/644,0)
    PlayerLeftLegSlot.Image = "rbxassetid://131490717"
    PlayerLeftLegSlot.ZIndex = 4
    PlayerLeftLegSlot.Parent = Background

    local EyeBackgroundSlot = Instance.new("ImageLabel")
    EyeBackgroundSlot.BackgroundTransparency = 1
    EyeBackgroundSlot.Size = UDim2.new(64/902,0,64/644,0)
    EyeBackgroundSlot.Position = UDim2.new(168/902,0,434/644,0)
    EyeBackgroundSlot.Image = "rbxassetid://5655605683"
    EyeBackgroundSlot.ZIndex = 4
    EyeBackgroundSlot.Parent = Background

    local EyeBackgroundItemFrame = ItemIcon.new()
    EyeBackgroundItemFrame:SetParent(EyeBackgroundSlot)
    EyeBackgroundItemFrame:SetItem("MapEyeBackBrown")
    self.EyeBackgroundItemFrame = EyeBackgroundItemFrame

    local EyeFrontSlot = Instance.new("ImageLabel")
    EyeFrontSlot.BackgroundTransparency = 1
    EyeFrontSlot.Size = UDim2.new(64/902,0,64/644,0)
    EyeFrontSlot.Position = UDim2.new(244/902,0,434/644,0)
    EyeFrontSlot.Image = "rbxassetid://5655605683"
    EyeFrontSlot.ZIndex = 4
    EyeFrontSlot.Parent = Background

    local EyeFrontItemFrame = ItemIcon.new()
    EyeFrontItemFrame:SetParent(EyeFrontSlot)
    EyeFrontItemFrame:SetItem("MapEyeFrontDefault")
    self.EyeFrontItemFrame = EyeFrontItemFrame

    local PlayerDisplayFrame = Instance.new("Frame")
    PlayerDisplayFrame.BackgroundTransparency = 1
    PlayerDisplayFrame.Size = UDim2.new(0.6,0,0.6,0)
    PlayerDisplayFrame.Position = UDim2.new(0.05,0,0.2,0)
    PlayerDisplayFrame.SizeConstraint = "RelativeYY"
    PlayerDisplayFrame.Parent = Background
    self.PlayerDisplay = PlayerDisplay.new(PlayerDisplayFrame)

    --Create the pet inventory slots.
    local PetTypeContainer = Instance.new("ImageLabel")
    PetTypeContainer.BackgroundTransparency = 1
    PetTypeContainer.Size = UDim2.new(387/902,0,72/644,0)
    PetTypeContainer.Position = UDim2.new(40/902,0,28/644,0)
    PetTypeContainer.Image = "rbxassetid://132073816"
    PetTypeContainer.Visible = false
    PetTypeContainer.Parent = Background

    local DogToggleButton = Instance.new("ImageButton")
    DogToggleButton.BackgroundTransparency = 1
    DogToggleButton.AnchorPoint = Vector2.new(0.5,0.5)
    DogToggleButton.Size = UDim2.new(54/387,0,55/72,0)
    DogToggleButton.Position = UDim2.new(54/387,0,36/72,0)
    DogToggleButton.Parent = PetTypeContainer

    local CatToggleButton = Instance.new("ImageButton")
    CatToggleButton.BackgroundTransparency = 1
    CatToggleButton.AnchorPoint = Vector2.new(0.5,0.5)
    CatToggleButton.Size = UDim2.new(54/387,0,55/72,0)
    CatToggleButton.Position = UDim2.new(111/387,0,36/72,0)
    CatToggleButton.Parent = PetTypeContainer

    local PigToggleButton = Instance.new("ImageButton")
    PigToggleButton.BackgroundTransparency = 1
    PigToggleButton.AnchorPoint = Vector2.new(0.5,0.5)
    PigToggleButton.Size = UDim2.new(54/387,0,55/72,0)
    PigToggleButton.Position = UDim2.new(168/387,0,36/72,0)
    PigToggleButton.Parent = PetTypeContainer

    local HorseToggleButton = Instance.new("ImageButton")
    HorseToggleButton.BackgroundTransparency = 1
    HorseToggleButton.AnchorPoint = Vector2.new(0.5,0.5)
    HorseToggleButton.Size = UDim2.new(54/387,0,55/72,0)
    HorseToggleButton.Position = UDim2.new(225/387,0,36/72,0)
    HorseToggleButton.Parent = PetTypeContainer

    local PandaToggleButton = Instance.new("ImageButton")
    PandaToggleButton.BackgroundTransparency = 1
    PandaToggleButton.AnchorPoint = Vector2.new(0.5,0.5)
    PandaToggleButton.Size = UDim2.new(54/387,0,55/72,0)
    PandaToggleButton.Position = UDim2.new(279/387,0,36/72,0)
    PandaToggleButton.Parent = PetTypeContainer

    local DragonToggleButton = Instance.new("ImageButton")
    DragonToggleButton.BackgroundTransparency = 1
    DragonToggleButton.AnchorPoint = Vector2.new(0.5,0.5)
    DragonToggleButton.Size = UDim2.new(54/387,0,55/72,0)
    DragonToggleButton.Position = UDim2.new(336/387,0,36/72,0)
    DragonToggleButton.Parent = PetTypeContainer

    self.PetToggleButtons = {
        Dog = {DogToggleButton,"rbxassetid://132064980","rbxassetid://132064940","rbxassetid://132064966"},
        Cat = {CatToggleButton,"rbxassetid://132064800","rbxassetid://132064800","rbxassetid://132064768"},
        Pig = {PigToggleButton,"rbxassetid://132065232","rbxassetid://132065183","rbxassetid://132065208"},
        Horse = {HorseToggleButton,"rbxassetid://132065751","rbxassetid://132065680","rbxassetid://132065721"},
        Panda = {PandaToggleButton,"rbxassetid://132065130","rbxassetid://132065075","rbxassetid://132065098"},
        Dragon = {DragonToggleButton,"rbxassetid://132065051","rbxassetid://132064995","rbxassetid://132065018"},
    }

    local DB = true
    for PetName,ButtonData in pairs(self.PetToggleButtons) do
        ButtonData[1].Image = ButtonData[2]
        ButtonData[1].MouseEnter:Connect(function()
            if self.PlayerData:GetValue("CurrentPet") ~= PetName then
                ButtonData[1].Image = ButtonData[3]
            end
        end)
        ButtonData[1].MouseLeave:Connect(function()
            if self.PlayerData:GetValue("CurrentPet") ~= PetName then
                ButtonData[1].Image = ButtonData[2]
            end
        end)
        ButtonData[1].MouseButton1Down:Connect(function()
            if DB then
                DB = false
                self:SetPet(PetName)
                wait()
                DB = true
            end
        end)
    end

    local PetHatSlot = Instance.new("ImageLabel")
    PetHatSlot.BackgroundTransparency = 1
    PetHatSlot.Size = UDim2.new(64/902,0,64/644,0)
    PetHatSlot.Position = UDim2.new(369/902,0,206/644,0)
    PetHatSlot.Image = "rbxassetid://131490682"
    PetHatSlot.Visible = false
    PetHatSlot.ZIndex = 3
    PetHatSlot.Parent = Background

    local PetCollarSlot = Instance.new("ImageLabel")
    PetCollarSlot.BackgroundTransparency = 1
    PetCollarSlot.Size = UDim2.new(64/902,0,64/644,0)
    PetCollarSlot.Position = UDim2.new(369/902,0,282/644,0)
    PetCollarSlot.Image = "rbxassetid://131528533"
    PetCollarSlot.Visible = false
    PetCollarSlot.ZIndex = 3
    PetCollarSlot.Parent = Background

    local PetBackSlot = Instance.new("ImageLabel")
    PetBackSlot.BackgroundTransparency = 1
    PetBackSlot.Size = UDim2.new(64/902,0,64/644,0)
    PetBackSlot.Position = UDim2.new(369/902,0,358/644,0)
    PetBackSlot.Image = "rbxassetid://131528494"
    PetBackSlot.Visible = false
    PetBackSlot.ZIndex = 3
    PetBackSlot.Parent = Background
    
    local PetAnkleSlot = Instance.new("ImageLabel")
    PetAnkleSlot.BackgroundTransparency = 1
    PetAnkleSlot.Size = UDim2.new(64/902,0,64/644,0)
    PetAnkleSlot.Position = UDim2.new(369/902,0,434/644,0)
    PetAnkleSlot.Image = "rbxassetid://131528543"
    PetAnkleSlot.Visible = false
    PetAnkleSlot.ZIndex = 3
    PetAnkleSlot.Parent = Background

    local PetDisplayFrame = Instance.new("Frame")
    PetDisplayFrame.BackgroundTransparency = 1
    PetDisplayFrame.Size = UDim2.new(0.6,0,0.6,0)
    PetDisplayFrame.Position = UDim2.new(0.05,0,0.2,0)
    PetDisplayFrame.SizeConstraint = "RelativeYY"
    PetDisplayFrame.Visible = false
    PetDisplayFrame.Parent = Background
    self.PetDisplay = PetDisplay.new(PetDisplayFrame)

    --Create the toggle buttons.
    local PetModeToggleImage = Instance.new("ImageLabel")
    PetModeToggleImage.BackgroundTransparency = 1
    PetModeToggleImage.Size = UDim2.new(108/902,0,111/644,0)
    PetModeToggleImage.Position = UDim2.new(342/902,0,104/644,0)
    PetModeToggleImage.ZIndex = 4
    PetModeToggleImage.Parent = Background
    local PetModeToggleButton = ImageEventBinder.new(PetModeToggleImage,UDim2.new(1,0,1,0),"rbxassetid://132064980","rbxassetid://132064940","rbxassetid://132064966")

    local CharacterModeToggleImage = Instance.new("ImageLabel")
    CharacterModeToggleImage.BackgroundTransparency = 1
    CharacterModeToggleImage.Size = UDim2.new(240/902,0,60/644,0)
    CharacterModeToggleImage.Position = UDim2.new(230/902,0,102/644,0)
    CharacterModeToggleImage.Visible = false
    CharacterModeToggleImage.Parent = Background
    local CharacterModeToggleButton = ImageEventBinder.new(CharacterModeToggleImage,UDim2.new(0.8,0,0.8,0),"rbxassetid://131528431","rbxassetid://131528431","rbxassetid://131528420")

    PetModeToggleButton.Button.MouseButton1Down:Connect(function()
        if DB then
            DB = false
            PetModeToggleImage.Visible = false
            LevelBackground.Visible = false
            PlayerHeadSlot.Visible = false
            PlayerTorsoSlot.Visible = false
            PlayerRightArmSlot.Visible = false
            PlayerRightLegSlot.Visible = false
            PlayerLeftArmSlot.Visible = false
            PlayerLeftLegSlot.Visible = false
            EyeBackgroundSlot.Visible = false
            EyeFrontSlot.Visible = false
            PlayerDisplayFrame.Visible = false

            CharacterModeToggleImage.Visible = true
            PetTypeContainer.Visible = true
            PetHatSlot.Visible = true
            PetCollarSlot.Visible = true
            PetBackSlot.Visible = true
            PetAnkleSlot.Visible = true
            PetDisplayFrame.Visible = true
            wait()
            DB = true
        end
    end)
    CharacterModeToggleButton.Button.MouseButton1Down:Connect(function()
        if DB then
            DB = false
            PetModeToggleImage.Visible = true
            LevelBackground.Visible = true
            PlayerHeadSlot.Visible = true
            PlayerTorsoSlot.Visible = true
            PlayerRightArmSlot.Visible = true
            PlayerRightLegSlot.Visible = true
            PlayerLeftArmSlot.Visible = true
            PlayerLeftLegSlot.Visible = true
            PlayerDisplayFrame.Visible = true
            EyeBackgroundSlot.Visible = true
            EyeFrontSlot.Visible = true

            CharacterModeToggleImage.Visible = false
            PetTypeContainer.Visible = false
            PetHatSlot.Visible = false
            PetCollarSlot.Visible = false
            PetBackSlot.Visible = false
            PetAnkleSlot.Visible = false
            PetDisplayFrame.Visible = false
            wait()
            DB = true
        end
    end)

    --Create the inventory display.
    local InventoryBack = Instance.new("ImageLabel")
    InventoryBack.BackgroundTransparency = 1
    InventoryBack.Size = UDim2.new(329/902,0,558/644,0)
    InventoryBack.Position = UDim2.new(495/902,0,30/644,0)
    InventoryBack.Image = "rbxassetid://131503240"
    InventoryBack.Parent = Background

    local InventoryBorder = Instance.new("ImageLabel")
    InventoryBorder.BackgroundTransparency = 1
    InventoryBorder.AnchorPoint = Vector2.new(0.5,0)
    InventoryBorder.Size = UDim2.new(343/329,0,471/558,0)
    InventoryBorder.Position = UDim2.new(163/329,0,35/558,0)
    InventoryBorder.Image = "rbxassetid://131502836"
    InventoryBorder.ZIndex = 5
    InventoryBorder.Parent = InventoryBack

    local InventoryLeftImage = Instance.new("ImageLabel")
    InventoryLeftImage.BackgroundTransparency = 1
    InventoryLeftImage.AnchorPoint = Vector2.new(0.5,0.5)
    InventoryLeftImage.Size = UDim2.new(39/329,0,28/558,0)
    InventoryLeftImage.Position = UDim2.new(63/329,0,1 + (-31/558),0)
    InventoryLeftImage.Parent = InventoryBack
    self.InventoryLeftImage = InventoryLeftImage
    local InventoryLeftButton = ImageEventBinder.new(InventoryLeftImage,UDim2.new(1,0,1,0),"rbxassetid://131462464","rbxassetid://131462433","rbxassetid://131462447")

    local InventoryRightImage = Instance.new("ImageButton")
    InventoryRightImage.BackgroundTransparency = 1
    InventoryRightImage.AnchorPoint = Vector2.new(0.5,0.5)
    InventoryRightImage.Size = UDim2.new(39/329,0,28/558,0)
    InventoryRightImage.Position = UDim2.new(263/329,0,1 + (-31/558),0)
    InventoryRightImage.Parent = InventoryBack
    self.InventoryRightImage = InventoryRightImage
    local InventoryRightButton = ImageEventBinder.new(InventoryRightImage,UDim2.new(1,0,1,0),"rbxassetid://131462518","rbxassetid://131462503","rbxassetid://131462515")

    local PageText = Instance.new("TextLabel")
    PageText.BackgroundTransparency = 1
    PageText.Size = UDim2.new(33/329,0,50/558,0)
    PageText.Position = UDim2.new(186/329,0,1 + (-64/558),0)
    PageText.Font = Enum.Font.Antique
    PageText.Text = "1"
    PageText.TextColor3 = Color3.new(238/255,205/255,255/255)
    PageText.TextScaled = true
    PageText.Parent = InventoryBack
    self.PageText = PageText

    local TrashBackgroundSlot = Instance.new("ImageLabel")
    TrashBackgroundSlot.BackgroundTransparency = 1
    TrashBackgroundSlot.AnchorPoint = Vector2.new(1,1)
    TrashBackgroundSlot.Size = UDim2.new(64/902,0,64/644,0)
    TrashBackgroundSlot.Position = UDim2.new(876/902,0,607/644,0)
    TrashBackgroundSlot.Image = "rbxassetid://5655605683"
    TrashBackgroundSlot.ZIndex = 4
    TrashBackgroundSlot.Parent = Background

    self.InventorySlotFrames = {}
    self.InventorySlotIcons = {}
    for i = 1,SLOTS_PER_PAGE do
        local SlotFrame = Instance.new("Frame")
        SlotFrame.BackgroundTransparency = 1
        SlotFrame.Size = UDim2.new(64/329,0,64/558,0)
        SlotFrame.Position = UDim2.new((2 + (65 * ((i - 1) % 5)))/329,0,(43 + (65 * math.floor((i - 1)/5)))/558,0)
        SlotFrame.Parent = InventoryBack
        table.insert(self.InventorySlotFrames,SlotFrame)

        local ItemFrame = ItemIcon.new()
        ItemFrame:SetParent(SlotFrame)
        table.insert(self.InventorySlotIcons,ItemFrame)
    end
    self.SpecialInventorySlots = {
        PlayerHat = PlayerHeadSlot,
        PlayerTorso = PlayerTorsoSlot,
        PlayerLeftArm = PlayerLeftArmSlot,
        PlayerRightArm = PlayerRightArmSlot,
        PlayerLeftLeg = PlayerLeftLegSlot,
        PlayerRightLeg = PlayerRightLegSlot,
        MapEyeBack = EyeBackgroundSlot,
        MapEyeFront = EyeFrontSlot,
        PetCostumeHat = PetHatSlot,
        PetCostumeCollar = PetCollarSlot,
        PetCostumeBack = PetBackSlot,
        PetCostumeAnkle = PetAnkleSlot,
        Trash = TrashBackgroundSlot,
    }
    self.SpecialInventoryIcons = {}
    for SlotName,SlotFrame in pairs(self.SpecialInventorySlots) do
        local ItemFrame = ItemIcon.new()
        ItemFrame:SetParent(SlotFrame)
        self.SpecialInventoryIcons[SlotName] = ItemFrame
    end

    --Connect updating the inventory.
    self.CurrentPage = 1
    self.MaxPages = 3
    InventoryLeftButton.Button.MouseButton1Down:Connect(function()
        if DB then
            DB = false
            self.CurrentPage = math.max(1,self.CurrentPage - 1)
            self:UpdateInventory()
            wait()
            DB = true
        end
    end)
    InventoryRightButton.Button.MouseButton1Down:Connect(function()
        if DB then
            DB = false
            self.CurrentPage = math.min(self.MaxPages,self.CurrentPage + 1)
            self:UpdateInventory()
            wait()
            DB = true
        end
    end)
    self.Inventory.InventoryChanged:Connect(function()
        self:UpdateInventory()
    end)
    self.PlayerData:GetValueChangedSignal("PetsOwned"):Connect(function()
        self:UpdateInventory()
    end)
    self.PlayerData:GetValueChangedSignal("CurrentPet"):Connect(function()
        self:UpdateInventory()
    end)
    self:UpdateInventory()

    --Connect opening and closing.
    local OpenValue = script.Parent.Parent:WaitForChild("GuiOpenStates"):WaitForChild("Inventory")
    DisplayOrderController:Register(InventoryScreenGui,OpenValue)
    self.OpenValue = OpenValue
    OpenValue.Changed:Connect(function()
        Background:TweenPosition(UDim2.new(0.5,0,OpenValue.Value and 0.5 or 1.5,0),"Out","Quad",0.5,true)
    end)
    InventoryCloseButton.Button.MouseButton1Down:Connect(function()
        Background:TweenPosition(UDim2.new(0.5,0,1.5,0),"Out","Quad",0.5,true)
        OpenValue.Value = false
    end)

    --Set up dragging.
    self:SetUpDraggning()
end

--[[
Returns if a point is in a frame.
--]]
function InventoryWindow:PointInFrame(X,Y,Frame)
    local Size,Position = Frame.AbsoluteSize,Frame.AbsolutePosition
    return Frame.Visible and X >= Position.X and X <= Position.X + Size.X and Y >= Position.Y and Y <= Position.Y + Size.Y
end

--[[
Sets up dragging of items.
--]]
function InventoryWindow:SetUpDraggning()
    local CurrentSlot,CurrentDraggingFrame,CurrentIcon
    local DraggingOffsetX,DraggingOffsetY

    --Connect items being pressed.
    UserInputService.InputBegan:Connect(function(Input,Processed)
        --Return if the input was already processed or it wasn't a click.
        if Processed or (Input.UserInputType ~= Enum.UserInputType.MouseButton1 and Input.UserInputType ~= Enum.UserInputType.Touch) then
            return
        end

        --Return if the inventory isn't open.
        if not self.OpenValue.Value then
            return
        end

        --Clear the existing drag frame if one exists.
        --May be caused be opening the menu while dragging.
        if CurrentDraggingFrame then
            CurrentDraggingFrame:Destroy()
            CurrentDraggingFrame = nil
            CurrentIcon:Destroy()
        end

        --Determine the slot to start from.
        local Slot,StartSlotFrame
        for SlotName,SlotFrame in pairs(self.SpecialInventorySlots) do
            if self:PointInFrame(Input.Position.X,Input.Position.Y,SlotFrame) then
                Slot = SlotName
                StartSlotFrame = SlotFrame
                break
            end
        end
        if not Slot then
            for i,SlotFrame in pairs(self.InventorySlotFrames) do
                if self:PointInFrame(Input.Position.X,Input.Position.Y,SlotFrame) then
                    Slot = i + ((self.CurrentPage - 1)* SLOTS_PER_PAGE)
                    StartSlotFrame = SlotFrame
                    break
                end
            end
        end
        
        --Return if the slot or item doesn't exist.
        if not Slot then return end
        local Item = self.Inventory:GetItem(Slot)
        if not Item or not Item.Name then return end

        --Return if the item can't be dragged.
        local SlotItemData = ItemData[Item.Name]
        if SlotItemData and SlotItemData.CanDragCallback then
            if not SlotItemData.CanDragCallback(self.Inventory,Slot) then
                return
            end
        end

        --Create the dragging frame.
        CurrentSlot = Slot
        DraggingOffsetX = StartSlotFrame.AbsolutePosition.X - Input.Position.X
        DraggingOffsetY = StartSlotFrame.AbsolutePosition.Y - Input.Position.Y

        CurrentDraggingFrame = Instance.new("Frame")
        CurrentDraggingFrame.BackgroundTransparency = 1
        CurrentDraggingFrame.Size = UDim2.new(0,StartSlotFrame.AbsoluteSize.X,0,StartSlotFrame.AbsoluteSize.Y)
        CurrentDraggingFrame.Position = UDim2.new(0,StartSlotFrame.AbsolutePosition.X,0,StartSlotFrame.AbsolutePosition.Y)
        CurrentDraggingFrame.ZIndex = 20
        CurrentDraggingFrame.Parent = self.InventoryScreenGui

        CurrentIcon = ItemIcon.new()
        CurrentIcon:SetParent(CurrentDraggingFrame)
        CurrentIcon:SetItem(Item.Name)
        
        --Hide the starting icon.
        for SlotName,SlotIcon in pairs(self.SpecialInventoryIcons) do
            if SlotName == Slot then
                SlotIcon.ViewportFrame.Visible = false
                break
            end
        end
        if type(Slot) == "number" then
            for SlotName,SlotIcon in pairs(self.InventorySlotIcons) do
                if SlotName == ((Slot - 1) % SLOTS_PER_PAGE) + 1 then
                    SlotIcon.ViewportFrame.Visible = false
                    break
                end
            end
        end
    end)

    --Connect dragging.
    UserInputService.InputChanged:Connect(function(Input)
        --Return if the input it wasn't a click.
        if Input.UserInputType ~= Enum.UserInputType.MouseMovement and Input.UserInputType ~= Enum.UserInputType.Touch then
            return
        end

        --Move the frame.
        if CurrentDraggingFrame then
            CurrentDraggingFrame.Position = UDim2.new(0,Input.Position.X + DraggingOffsetX,0,Input.Position.Y + DraggingOffsetY)
        end
    end)

    --Connect ending the dragging.
    UserInputService.InputEnded:Connect(function(Input)
        --Return if the input it wasn't a click.
        if Input.UserInputType ~= Enum.UserInputType.MouseButton1 and Input.UserInputType ~= Enum.UserInputType.Touch then
            return
        end

        --Return if dragging wasn't started.
        if not CurrentDraggingFrame then
            return
        end

        --Determine the ending slot.
        local Slot
        for SlotName,SlotFrame in pairs(self.SpecialInventorySlots) do
            if self:PointInFrame(Input.Position.X,Input.Position.Y,SlotFrame) then
                Slot = SlotName
                break
            end
        end
        if not Slot then
            for i,SlotFrame in pairs(self.InventorySlotFrames) do
                if self:PointInFrame(Input.Position.X,Input.Position.Y,SlotFrame) then
                    Slot = i + ((self.CurrentPage - 1)* SLOTS_PER_PAGE)
                    break
                end
            end
        end

        --Swap the slots if they can be swapped.
        if Slot and self.Inventory:CanSwap(CurrentSlot,Slot) then
            self.Inventory:SwapSlots(CurrentSlot,Slot)
            SwapSlots:FireServer(CurrentSlot,Slot)
        end
        CurrentDraggingFrame:Destroy()
        CurrentDraggingFrame = nil
        CurrentIcon:Destroy()

        --Show the original icon.
        for _,SlotIcon in pairs(self.SpecialInventoryIcons) do
            SlotIcon.ViewportFrame.Visible = true
        end
        for _,SlotIcon in pairs(self.InventorySlotIcons) do
            SlotIcon.ViewportFrame.Visible = true
        end

        --Destroy the item if the ending slot was the trash.
        if Slot == "Trash" then
            self:PromptDelete(CurrentSlot)
        end
    end)
end

--[[
Updates the inventory.
--]]
function InventoryWindow:UpdateInventory()
    --Update the page display.
    self.MaxPages = self.Inventory:GetMaxItems() / SLOTS_PER_PAGE
    self.InventoryLeftImage.Visible = (self.CurrentPage ~= 1)
    self.InventoryRightImage.Visible = (self.CurrentPage ~= self.MaxPages)
    self.PageText.Text = tostring(self.CurrentPage)

    --Update the main slots.
    local SlotsIdOffset = SLOTS_PER_PAGE * (self.CurrentPage - 1)
    for i = 1,SLOTS_PER_PAGE do
        local Item = self.Inventory:GetItem(i + SlotsIdOffset)
        local Icon = self.InventorySlotIcons[i]
        if Item then
            Icon:SetItem(Item.Name)
        else
            Icon:SetItem()
        end
    end

    --Update the equipped slots.
    for SlotName,Icon in pairs(self.SpecialInventoryIcons) do
        local Item = self.Inventory:GetItem(SlotName)
        if Item then
            Icon:SetItem(Item.Name)
        else
            Icon:SetItem()
        end
    end

    --Update the selected pet.
    local CurrentPet = self.PlayerData:GetValue("CurrentPet")
    local PetsOwned = self.PlayerData:GetValue("PetsOwned")
    for PetName,ButtonData in pairs(self.PetToggleButtons) do
        ButtonData[1].Visible = (PetName == "Dog" or PetsOwned[PetName] == true)
        if PetName == CurrentPet then
            ButtonData[1].Image = ButtonData[4]
        else
            if ButtonData[1].Image == ButtonData[4] then
                ButtonData[1].Image = ButtonData[2]
            end
        end
    end

    --Update the player model.
    self.PlayerDisplay:SetHat(self.Inventory:GetItem("PlayerHat"))
    self.PlayerDisplay:SetItem("Torso",self.Inventory:GetItem("PlayerTorso"))
    self.PlayerDisplay:SetItem("LeftArm",self.Inventory:GetItem("PlayerLeftArm"))
    self.PlayerDisplay:SetItem("RightArm",self.Inventory:GetItem("PlayerRightArm"))
    self.PlayerDisplay:SetItem("LeftLeg",self.Inventory:GetItem("PlayerLeftLeg"))
    self.PlayerDisplay:SetItem("RightLeg",self.Inventory:GetItem("PlayerRightLeg"))
    self.PetDisplay:SetItem("PetCostumeHat",self.Inventory:GetItem("PetCostumeHat"))
    self.PetDisplay:SetItem("PetCostumeCollar",self.Inventory:GetItem("PetCostumeCollar"))
    self.PetDisplay:SetItem("PetCostumeBack",self.Inventory:GetItem("PetCostumeBack"))
    self.PetDisplay:SetItem("PetCostumeAnkle",self.Inventory:GetItem("PetCostumeAnkle"))
    self.PetDisplay:SetPet(CurrentPet)

    --Update the map indicator items.
    if self.Inventory:GetItem("MapEyeBack") then
        self.EyeBackgroundItemFrame:SetItem()
    else
        self.EyeBackgroundItemFrame:SetItem("MapEyeBackBrown")
    end
    if self.Inventory:GetItem("MapEyeFront") then
        self.EyeFrontItemFrame:SetItem()
    else
        self.EyeFrontItemFrame:SetItem("MapEyeFrontDefault")
    end
end

--[[
Sets the pet to use.
--]]
function InventoryWindow:SetPet(PetName)
    SetPet:FireServer(PetName)
    self.PlayerData:SetValue("CurrentPet",PetName)
end

--[[
Prompts deleting an item.
--]]
function InventoryWindow:PromptDelete(Slot)
    --Get the item data or return if it doesn't exist.
    local Item = self.Inventory:GetItem(Slot)
    if not Item then
        return
    end
    local Data = ItemData[Item.Name]
    if not Data then
        return
    end

    --Create the Gui.
    local DeleteScreenGui = Instance.new("ScreenGui")
    DeleteScreenGui.Name = "Inventory"
    DeleteScreenGui.DisplayOrder = 10
    DeleteScreenGui.Parent = script.Parent.Parent

    local Background = Instance.new("ImageLabel")
    Background.BackgroundTransparency = 1
    Background.AnchorPoint = Vector2.new(0.5,0.5)
    Background.Size = UDim2.new(0.15 * (188/52),0,0.15,0)
    Background.SizeConstraint = Enum.SizeConstraint.RelativeYY
    Background.Position = UDim2.new(0.5,0,-0.2,0)
    Background.Image = "rbxassetid://5558262263"
    Background.Parent = DeleteScreenGui
    Background:TweenPosition(UDim2.new(0.5,0,0.5,0),"Out","Quad",0.5)

    local DeleteText = Instance.new("TextLabel")
    DeleteText.BackgroundTransparency = 1
    DeleteText.Size = UDim2.new(0.8,0,0.3,0)
    DeleteText.Position = UDim2.new(0.1,0,0.15,0)
    DeleteText.Font = Enum.Font.Antique
    DeleteText.Text = "Delete "..(Data.DisplayName or tostring(Item.Name))
    DeleteText.TextColor3 = Color3.new(40/255,40/255,40/255)
    DeleteText.TextScaled = true
    DeleteText.Parent = Background

    local ConfirmImage = Instance.new("ImageLabel")
    ConfirmImage.BackgroundTransparency = 1
    ConfirmImage.AnchorPoint = Vector2.new(1,0)
    ConfirmImage.Size = UDim2.new(0.4 * (188/52),0,0.4,0)
    ConfirmImage.SizeConstraint = Enum.SizeConstraint.RelativeYY
    ConfirmImage.Position = UDim2.new(0.475,0,0.45,0)
    ConfirmImage.Image = "rbxassetid://5558262263"
    ConfirmImage.Parent = Background
    local ConfirmButton = WideTextButtonDecorator.new(ConfirmImage,"Yes")

    local CancelImage = Instance.new("ImageLabel")
    CancelImage.BackgroundTransparency = 1
    CancelImage.Size = UDim2.new(0.4 * (188/52),0,0.4,0)
    CancelImage.SizeConstraint = Enum.SizeConstraint.RelativeYY
    CancelImage.Position = UDim2.new(0.525,0,0.45,0)
    CancelImage.Image = "rbxassetid://5558262263"
    CancelImage.Parent = Background
    local CancelButton = WideTextButtonDecorator.new(CancelImage,"No")

    --Connect the buttons.
    local DB = true
    ConfirmButton.Button.MouseButton1Down:Connect(function()
        if DB then
            DB = false

            --Delete the item.
            self.Inventory:RemoveSlot(Slot)
            DeleteItem:FireServer(Slot)

            --Close the dialog.
            Background:TweenPosition(UDim2.new(0.5,0,-0.2,0),"Out","Quad",0.5,true,function()
                DeleteScreenGui:Destroy()
            end)
        end
    end)
    CancelButton.Button.MouseButton1Down:Connect(function()
        if DB then
            DB = false

            --Close the dialog.
            Background:TweenPosition(UDim2.new(0.5,0,-0.2,0),"Out","Quad",0.5,true,function()
                DeleteScreenGui:Destroy()
            end)
        end
    end)
end



return InventoryWindow