local Y=game.Players.LocalPlayer local F=Y:WaitForChild("\080\101\116\115")local W=game.ReplicatedStorage function getLevel(Y)local F=0 local m=W.Pets.Settings.MaxPetLevel.Value local A=-1 while true do if 100*A+F<=Y then if A~=W.Pets.Settings.MaxPetLevel.Value then else return A end if Y<(100*A+F)+(100+25*A)then return A end end F=F+A*25 if true then if A<m then else break end elseif m<A then else break end A=A+1 end end function GetFolderFromPetID(F)for Y,W in pairs(Y.Pets:GetChildren())do if W.PetID.Value==F then return W end end return nil end function getLayoutOrder(Y)local F=GetFolderFromPetID(Y)local m=(W.Pets.Rarities:FindFirstChild((W.Pets.Models:FindFirstChild(F.Name)).Settings.Rarity.Value)).Order.Value local A=W.Pets.Settings.MaxPetLevel.Value local l=getLevel(F.TotalXP.Value)local e={}local B=0 for Y,F in pairs(W.Pets.Models:GetChildren())do e[#e+1]=F end table.sort(e,function(Y,F)return Y:GetFullName()<F:GetFullName()end)for Y,b in pairs(e)do if F.Equipped.Value==true then if F.Name==b.Name then return((A*#e)*(#W.Pets.Rarities:GetChildren()-m)+B*A)+(A-l)end elseif F.Name==b.Name then return(((#e*#W.Pets.Rarities:GetChildren())*A+(A*#e)*(#W.Pets.Rarities:GetChildren()-m))+B*A)+(A-l)end B=B+1 end end local m=Y.PlayerGui:WaitForChild("\085\073\101\108\101\109\101\110\116\115")local A=script.Parent.MainFrame.Inventory function newUI(Y)local F=m.PetTemplate:Clone()local l=((W.Pets.Models:FindFirstChild(Y.Name)):FindFirstChild((Y:WaitForChild("\084\121\112\101")).Value)):Clone()local e=Instance.new("\067\097\109\101\114\097",F.PetView)local B=l.PrimaryPart.Position F.PetID.Value=(Y:WaitForChild("\080\101\116\073\068")).Value F.Name=Y.Name F.LevelLabel.Text="\076\118\108\046 "..getLevel((Y:WaitForChild("\084\111\116\097\108\088\080")).Value)F.PetView.CurrentCamera=e l.Parent=F.PetView e.CFrame=CFrame.new(Vector3.new(B.X+2.25,B.Y,B.Z+1),B)F.Parent=A A.CanvasSize=UDim2.new(0,0,0,A.UIGridLayout.AbsoluteContentSize.Y+200)if Y.Equipped.Value==true then F.EquipMarker.Visible=true else F.EquipMarker.Visible=false end;((Y:WaitForChild("\084\111\116\097\108\088\080")):GetPropertyChangedSignal("\086\097\108\117\101")):Connect(function()F.LevelLabel.Text="\076\118\108\046 "..getLevel((Y:WaitForChild("\084\111\116\097\108\088\080")).Value)end)for Y,F in pairs(A:GetChildren())do if not F:IsA("\085\073\071\114\105\100\076\097\121\111\117\116")then F.LayoutOrder=getLayoutOrder(F.PetID.Value)end end end for Y,F in pairs(F:GetChildren())do newUI(F)end local l=script.Parent.MainFrame.StorageDisplay.TextLabel local e=Y:WaitForChild("\068\097\116\097")local B=script.Parent.MainFrame.EquippedDisplay.TextLabel F.ChildAdded:Connect(function(Y)local W=0 for Y,F in pairs(F:GetChildren())do if(F:WaitForChild("\069\113\117\105\112\112\101\100")).Value==true then W=W+1 end end l.Text=#F:GetChildren()..("\047"..e.MaxStorage.Value)B.Text=W..("\047"..e.MaxEquip.Value)newUI(Y)end)F.ChildRemoved:Connect(function(Y)for F,W in pairs(A:GetChildren())do if not W:IsA("\085\073\071\114\105\100\076\097\121\111\117\116")and W.PetID.Value==Y.PetID.Value then W:Destroy()end end local W=0 for Y,F in pairs(F:GetChildren())do if F.Equipped.Value==true then W=W+1 end end l.Text=#F:GetChildren()..("\047"..e.MaxStorage.Value)B.Text=W..("\047"..e.MaxEquip.Value)end)A.ChildAdded:Connect(function()A.CanvasSize=UDim2.new(0,0,0,A.UIGridLayout.AbsoluteContentSize.Y+200)end)A.ChildRemoved:Connect(function()A.CanvasSize=UDim2.new(0,0,0,A.UIGridLayout.AbsoluteContentSize.Y+200)end)local b=0 for Y,F in pairs(F:GetChildren())do if F.Equipped.Value==true then b=b+1 end end;(e.MaxStorage:GetPropertyChangedSignal("\086\097\108\117\101")):Connect(function()l.Text=#F:GetChildren()..("\047"..e.MaxStorage.Value)end);(e.MaxEquip:GetPropertyChangedSignal("\086\097\108\117\101")):Connect(function()B.Text=b..("\047"..e.MaxEquip.Value)end)l.Text=#F:GetChildren()..("\047"..e.MaxStorage.Value)B.Text=b..("\047"..e.MaxEquip.Value)
-- Decompiled with the Synapse X Luau decompiler.

local l__LocalPlayer__1 = game.Players.LocalPlayer
local l__Pets__2 = l__LocalPlayer__1:WaitForChild("Pets")
local l__ReplicatedStorage__1 = game.ReplicatedStorage
function getLevel(p1)
	local v3 = 0
	local l__Value__4 = l__ReplicatedStorage__1.Pets.Settings.MaxPetLevel.Value
	local v5 = 0 - 1
	while true do
		if 100 * v5 + v3 <= p1 then
			if v5 ~= l__ReplicatedStorage__1.Pets.Settings.MaxPetLevel.Value then
			else
				return v5
			end
			if p1 < 100 * v5 + v3 + (100 + 25 * v5) then
				return v5
			end
		end
		v3 = v3 + v5 * 25
		if 0 <= 1 then
			if v5 < l__Value__4 then
			else
				break
			end
		elseif l__Value__4 < v5 then
		else
			break
		end
		v5 = v5 + 1
	end
end
function GetFolderFromPetID(p2)
	for v9, v10 in pairs(l__LocalPlayer__1.Pets:GetChildren()) do
		if v10.PetID.Value == p2 then
			return v10
		end
	end
	return nil
end
function getLayoutOrder(p3)
	local v11 = GetFolderFromPetID(p3)
	local l__Value__12 = l__ReplicatedStorage__1.Pets.Rarities:FindFirstChild(
		l__ReplicatedStorage__1.Pets.Models:FindFirstChild(v11.Name).Settings.Rarity.Value
	).Order.Value
	local l__Value__13 = l__ReplicatedStorage__1.Pets.Settings.MaxPetLevel.Value
	local v14 = getLevel(v11.TotalXP.Value)
	local v15 = {}
	local v16 = 0
	for v20, v21 in pairs(l__ReplicatedStorage__1.Pets.Models:GetChildren()) do
		v15[#v15 + 1] = v21
	end
	table.sort(v15, function(p4, p5)
		return p4:GetFullName() < p5:GetFullName()
	end)
	for v26, v25 in pairs(v15) do
		if v11.Equipped.Value == true then
			if v11.Name == v25.Name then
				return l__Value__13 * #v15 * (#l__ReplicatedStorage__1.Pets.Rarities:GetChildren() - l__Value__12)
					+ v16 * l__Value__13
					+ (l__Value__13 - v14)
			end
		elseif v11.Name == v25.Name then
			return #v15 * #l__ReplicatedStorage__1.Pets.Rarities:GetChildren() * l__Value__13
				+ l__Value__13 * #v15 * (#l__ReplicatedStorage__1.Pets.Rarities:GetChildren() - l__Value__12)
				+ v16 * l__Value__13
				+ (l__Value__13 - v14)
		end
		v16 = v16 + 1
	end
end
local l__UIelements__2 = l__LocalPlayer__1.PlayerGui:WaitForChild("UIelements")
local l__Inventory__3 = script.Parent.MainFrame.Inventory
function newUI(p6)
	local v27 = l__UIelements__2.PetTemplate:Clone()
	local v28 = l__ReplicatedStorage__1.Pets.Models
		:FindFirstChild(p6.Name)
		:FindFirstChild(p6:WaitForChild("Type").Value)
		:Clone()
	local v29 = Instance.new("Camera", v27.PetView)
	local l__Position__30 = v28.PrimaryPart.Position
	v27.PetID.Value = p6:WaitForChild("PetID").Value
	v27.Name = p6.Name
	v27.LevelLabel.Text = "Lvl. " .. getLevel(p6:WaitForChild("TotalXP").Value)
	v27.PetView.CurrentCamera = v29
	v28.Parent = v27.PetView
	v29.CFrame =
		CFrame.new(Vector3.new(l__Position__30.X + 2.25, l__Position__30.Y, l__Position__30.Z + 1), l__Position__30)
	v27.Parent = l__Inventory__3
	l__Inventory__3.CanvasSize = UDim2.new(0, 0, 0, l__Inventory__3.UIGridLayout.AbsoluteContentSize.Y + 200)
	if p6.Equipped.Value == true then
		v27.EquipMarker.Visible = true
	else
		v27.EquipMarker.Visible = false
	end
	p6:WaitForChild("TotalXP"):GetPropertyChangedSignal("Value"):Connect(function()
		v27.LevelLabel.Text = "Lvl. " .. getLevel(p6:WaitForChild("TotalXP").Value)
	end)
	for v34, v35 in pairs(l__Inventory__3:GetChildren()) do
		if not v35:IsA("UIGridLayout") then
			v35.LayoutOrder = getLayoutOrder(v35.PetID.Value)
		end
	end
end
for v36, v37 in pairs(l__Pets__2:GetChildren()) do
	newUI(v37)
end
local l__TextLabel__4 = script.Parent.MainFrame.StorageDisplay.TextLabel
local l__Data__5 = l__LocalPlayer__1:WaitForChild("Data")
local l__TextLabel__6 = script.Parent.MainFrame.EquippedDisplay.TextLabel
l__Pets__2.ChildAdded:Connect(function(p7)
	local v38 = 0
	for v39, v40 in pairs(l__Pets__2:GetChildren()) do
		if v40:WaitForChild("Equipped").Value == true then
			v38 = v38 + 1
		end
	end
	l__TextLabel__4.Text = #l__Pets__2:GetChildren() .. "/" .. l__Data__5.MaxStorage.Value
	l__TextLabel__6.Text = v38 .. "/" .. l__Data__5.MaxEquip.Value
	newUI(p7)
end)
l__Pets__2.ChildRemoved:Connect(function(p8)
	for v41, v42 in pairs(l__Inventory__3:GetChildren()) do
		if not v42:IsA("UIGridLayout") and v42.PetID.Value == p8.PetID.Value then
			v42:Destroy()
		end
	end
	local v43 = 0
	for v44, v45 in pairs(l__Pets__2:GetChildren()) do
		if v45.Equipped.Value == true then
			v43 = v43 + 1
		end
	end
	l__TextLabel__4.Text = #l__Pets__2:GetChildren() .. "/" .. l__Data__5.MaxStorage.Value
	l__TextLabel__6.Text = v43 .. "/" .. l__Data__5.MaxEquip.Value
end)
l__Inventory__3.ChildAdded:Connect(function()
	l__Inventory__3.CanvasSize = UDim2.new(0, 0, 0, l__Inventory__3.UIGridLayout.AbsoluteContentSize.Y + 200)
end)
l__Inventory__3.ChildRemoved:Connect(function()
	l__Inventory__3.CanvasSize = UDim2.new(0, 0, 0, l__Inventory__3.UIGridLayout.AbsoluteContentSize.Y + 200)
end)
local v46 = 0
for v47, v48 in pairs(l__Pets__2:GetChildren()) do
	if v48.Equipped.Value == true then
		v46 = v46 + 1
	end
end
l__Data__5.MaxStorage:GetPropertyChangedSignal("Value"):Connect(function()
	l__TextLabel__4.Text = #l__Pets__2:GetChildren() .. "/" .. l__Data__5.MaxStorage.Value
end)
l__Data__5.MaxEquip:GetPropertyChangedSignal("Value"):Connect(function()
	l__TextLabel__6.Text = v46 .. "/" .. l__Data__5.MaxEquip.Value
end)
l__TextLabel__4.Text = #l__Pets__2:GetChildren() .. "/" .. l__Data__5.MaxStorage.Value
l__TextLabel__6.Text = v46 .. "/" .. l__Data__5.MaxEquip.Value
