local h=game.Players.LocalPlayer local L=game.ReplicatedStorage function getLevel(h)local x=0 local T=L.Pets.Settings.MaxPetLevel.Value local m=-1 while true do if 100*m+x<=h then if m~=L.Pets.Settings.MaxPetLevel.Value then else return m end if h<(100*m+x)+(100+25*m)then return m end end x=x+m*25 if true then if m<T then else break end elseif T<m then else break end m=m+1 end end function GetFolderFromPetID(L)local x,T,m=pairs(h.Pets:GetChildren())while true do local h,B=x(T,m)if h then else break end m=h if B.PetID.Value==L then return B end end return nil end function getLayoutOrder(h)local x=GetFolderFromPetID(h)local T=(L.Pets.Rarities:FindFirstChild((L.Pets.Models:FindFirstChild(x.Name)).Settings.Rarity.Value)).Order.Value local m=L.Pets.Settings.MaxPetLevel.Value local B=getLevel(x.TotalXP.Value)local P={}local D=0 local M,X,e=pairs(L.Pets.Models:GetChildren())while true do local h,L=M(X,e)if h then else break end e=h P[#P+1]=L end table.sort(P,function(h,L)return h:GetFullName()<L:GetFullName()end)local C,J,f=pairs(P)while true do local h=nil local M=nil M,h=C(J,f)if M then else break end f=M if x.Equipped.Value==true then if x.Name==h.Name then return((m*#P)*(#L.Pets.Rarities:GetChildren()-T)+D*m)+(m-B)end elseif x.Name==h.Name then return(((#P*#L.Pets.Rarities:GetChildren())*m+(m*#P)*(#L.Pets.Rarities:GetChildren()-T))+D*m)+(m-B)end D=D+1 end end local x=Color3.fromRGB(100,100,100)local T=script.Parent.Parent.Parent.Parent.MainFrame.Inventory local m=h:WaitForChild("\080\101\116\115")local B=script.Parent.Parent.Parent.Parent.MainFrame.StorageDisplay.TextLabel local P=h:WaitForChild("\068\097\116\097")local D=script.Parent.Parent.Parent.Parent.MainFrame.EquippedDisplay.TextLabel local M=script.Parent.ImageColor3 script.Parent.MouseButton1Click:Connect(function()if script.Parent.TextLabel.Text=="\069\113\117\105\112"then local h,M=L.RemoteEvents.PetActionRequest:InvokeServer("\069\113\117\105\112",{PetID=script.Parent.Parent.Parent.PetID.Value})if h=="\083\117\099\099\101\115\115"then script.Parent.ImageColor3=x script.Parent.TextLabel.Text="\085\110\101\113\117\105\112"for h,L in pairs(T:GetChildren())do if not L:IsA("\085\073\071\114\105\100\076\097\121\111\117\116")then L.LayoutOrder=getLayoutOrder(L.PetID.Value)if L.PetID.Value==script.Parent.Parent.Parent.PetID.Value then L.EquipMarker.Visible=true end end end local h=0 for L,x in pairs(m:GetChildren())do if x.Equipped.Value==true then h=h+1 end end B.Text=#m:GetChildren()..("\047"..P.MaxStorage.Value)D.Text=h..("\047"..P.MaxEquip.Value)return elseif h=="\069\114\114\111\114"then print(M)return end elseif script.Parent.TextLabel.Text=="\085\110\101\113\117\105\112"then local h,x=L.RemoteEvents.PetActionRequest:InvokeServer("\085\110\101\113\117\105\112",{PetID=script.Parent.Parent.Parent.PetID.Value})if h=="\083\117\099\099\101\115\115"then script.Parent.ImageColor3=M script.Parent.TextLabel.Text="\069\113\117\105\112"for h,L in pairs(T:GetChildren())do if not L:IsA("\085\073\071\114\105\100\076\097\121\111\117\116")then L.LayoutOrder=getLayoutOrder(L.PetID.Value)if L.PetID.Value==script.Parent.Parent.Parent.PetID.Value then L.EquipMarker.Visible=false end end end local h=0 for L,x in pairs(m:GetChildren())do if x.Equipped.Value==true then h=h+1 end end B.Text=#m:GetChildren()..("\047"..P.MaxStorage.Value)D.Text=h..("\047"..P.MaxEquip.Value)return elseif h=="\069\114\114\111\114"then print(x)end end end)
-- Decompiled with the Synapse X Luau decompiler.

local l__LocalPlayer__1 = game.Players.LocalPlayer
local l__ReplicatedStorage__1 = game.ReplicatedStorage
function getLevel(p1)
	local v2 = 0
	local l__Value__3 = l__ReplicatedStorage__1.Pets.Settings.MaxPetLevel.Value
	local v4 = 0 - 1
	while true do
		if 100 * v4 + v2 <= p1 then
			if v4 ~= l__ReplicatedStorage__1.Pets.Settings.MaxPetLevel.Value then
			else
				return v4
			end
			if p1 < 100 * v4 + v2 + (100 + 25 * v4) then
				return v4
			end
		end
		v2 = v2 + v4 * 25
		if 0 <= 1 then
			if v4 < l__Value__3 then
			else
				break
			end
		elseif l__Value__3 < v4 then
		else
			break
		end
		v4 = v4 + 1
	end
end
function GetFolderFromPetID(p2)
	local v5, v6, v7 = pairs(l__LocalPlayer__1.Pets:GetChildren())
	while true do
		local v8, v9 = v5(v6, v7)
		if v8 then
		else
			break
		end
		v7 = v8
		if v9.PetID.Value == p2 then
			return v9
		end
	end
	return nil
end
function getLayoutOrder(p3)
	local v10 = GetFolderFromPetID(p3)
	local l__Value__11 = l__ReplicatedStorage__1.Pets.Rarities:FindFirstChild(
		l__ReplicatedStorage__1.Pets.Models:FindFirstChild(v10.Name).Settings.Rarity.Value
	).Order.Value
	local l__Value__12 = l__ReplicatedStorage__1.Pets.Settings.MaxPetLevel.Value
	local v13 = getLevel(v10.TotalXP.Value)
	local v14 = {}
	local v15 = 0
	local v16, v17, v18 = pairs(l__ReplicatedStorage__1.Pets.Models:GetChildren())
	while true do
		local v19, v20 = v16(v17, v18)
		if v19 then
		else
			break
		end
		v18 = v19
		v14[#v14 + 1] = v20
	end
	table.sort(v14, function(p4, p5)
		return p4:GetFullName() < p5:GetFullName()
	end)
	local v21, v22, v23 = pairs(v14)
	while true do
		local v24 = nil
		local v25 = nil
		v25, v24 = v21(v22, v23)
		if v25 then
		else
			break
		end
		v23 = v25
		if v10.Equipped.Value == true then
			if v10.Name == v24.Name then
				return l__Value__12 * #v14 * (#l__ReplicatedStorage__1.Pets.Rarities:GetChildren() - l__Value__11)
					+ v15 * l__Value__12
					+ (l__Value__12 - v13)
			end
		elseif v10.Name == v24.Name then
			return #v14 * #l__ReplicatedStorage__1.Pets.Rarities:GetChildren() * l__Value__12
				+ l__Value__12 * #v14 * (#l__ReplicatedStorage__1.Pets.Rarities:GetChildren() - l__Value__11)
				+ v15 * l__Value__12
				+ (l__Value__12 - v13)
		end
		v15 = v15 + 1
	end
end
local u2 = Color3.fromRGB(100, 100, 100)
local l__Inventory__3 = script.Parent.Parent.Parent.Parent.MainFrame.Inventory
local l__Pets__4 = l__LocalPlayer__1:WaitForChild("Pets")
local l__TextLabel__5 = script.Parent.Parent.Parent.Parent.MainFrame.StorageDisplay.TextLabel
local l__Data__6 = l__LocalPlayer__1:WaitForChild("Data")
local l__TextLabel__7 = script.Parent.Parent.Parent.Parent.MainFrame.EquippedDisplay.TextLabel
local l__ImageColor3__8 = script.Parent.ImageColor3
script.Parent.MouseButton1Click:Connect(function()
	if script.Parent.TextLabel.Text == "Equip" then
		local v26, v27 = l__ReplicatedStorage__1.RemoteEvents.PetActionRequest:InvokeServer("Equip", {
			PetID = script.Parent.Parent.Parent.PetID.Value,
		})
		if v26 == "Success" then
			script.Parent.ImageColor3 = u2
			script.Parent.TextLabel.Text = "Unequip"
			for v28, v29 in pairs(l__Inventory__3:GetChildren()) do
				if not v29:IsA("UIGridLayout") then
					v29.LayoutOrder = getLayoutOrder(v29.PetID.Value)
					if v29.PetID.Value == script.Parent.Parent.Parent.PetID.Value then
						v29.EquipMarker.Visible = true
					end
				end
			end
			local v30 = 0
			for v31, v32 in pairs(l__Pets__4:GetChildren()) do
				if v32.Equipped.Value == true then
					v30 = v30 + 1
				end
			end
			l__TextLabel__5.Text = #l__Pets__4:GetChildren() .. "/" .. l__Data__6.MaxStorage.Value
			l__TextLabel__7.Text = v30 .. "/" .. l__Data__6.MaxEquip.Value
			return
		elseif v26 == "Error" then
			print(v27)
			return
		end
	elseif script.Parent.TextLabel.Text == "Unequip" then
		local v33, v34 = l__ReplicatedStorage__1.RemoteEvents.PetActionRequest:InvokeServer("Unequip", {
			PetID = script.Parent.Parent.Parent.PetID.Value,
		})
		if v33 == "Success" then
			script.Parent.ImageColor3 = l__ImageColor3__8
			script.Parent.TextLabel.Text = "Equip"
			for v35, v36 in pairs(l__Inventory__3:GetChildren()) do
				if not v36:IsA("UIGridLayout") then
					v36.LayoutOrder = getLayoutOrder(v36.PetID.Value)
					if v36.PetID.Value == script.Parent.Parent.Parent.PetID.Value then
						v36.EquipMarker.Visible = false
					end
				end
			end
			local v37 = 0
			for v38, v39 in pairs(l__Pets__4:GetChildren()) do
				if v39.Equipped.Value == true then
					v37 = v37 + 1
				end
			end
			l__TextLabel__5.Text = #l__Pets__4:GetChildren() .. "/" .. l__Data__6.MaxStorage.Value
			l__TextLabel__7.Text = v37 .. "/" .. l__Data__6.MaxEquip.Value
			return
		elseif v33 == "Error" then
			print(v34)
		end
	end
end)
