local L=game.ReplicatedStorage local w=script.Parent.CurrentTarget local F=script.Parent.PetsFrame function resetFrame()for L,w in pairs(F.Frame:GetChildren())do if w.Name~="\085\073\067\111\114\110\101\114"then for L,w in pairs(w.PetView:GetChildren())do w:Destroy()end w.Percentage.Text=""w.Rarity.Text=""w.ImageColor3=Color3.fromRGB(25,25,25)end end end local K=require(L.Pets.Eggs)local z=script.Parent.CostLabel local b=L.Pets.Models;(w:GetPropertyChangedSignal("\086\097\108\117\101")):Connect(function()if w.Value=="\078\111\110\101"then resetFrame()return end local A=K[w.Value]local B=A.Currency local m=0 local q={}for L,w in pairs(A.Pets)do q[#q+1]={Name=w.Name,Type=w.Type;Rarity=w.Rarity;Secret=w.Secret}m=m+w.Rarity end z.CurrencyImage.Image=(L.Pets.Settings:FindFirstChild(B.."\073\109\097\103\101")).Value z.TextLabel.Text=A.Cost table.sort(q,function(L,w)return w.Rarity<L.Rarity end)if B~="\082\036"then script.Parent.BuyButtonR.Visible=true script.Parent.BuyButtonT.Visible=true script.Parent.BuyButtonE.Size=script.Parent.BuyButtonR.Size else script.Parent.BuyButtonR.Visible=false script.Parent.BuyButtonT.Visible=false script.Parent.BuyButtonE.Size=script.Parent.CostLabel.Size end resetFrame()for w,K in pairs(q)do if K.Secret==false then local z=K.Name local A=((b:FindFirstChild(z)):FindFirstChild(K.Type)):Clone()local B=F.Frame:FindFirstChild("\083\108\111\116"..w)local q=B.PetView local Y=math.floor((K.Rarity/m)*10000)/100 local E=(b:FindFirstChild(z)).Settings.Rarity.Value local G=(L.Pets.Rarities:FindFirstChild(E)).Color.Value local U=Instance.new("\067\097\109\101\114\097",q)local M=Vector3.new(0,0,0)q.CurrentCamera=U A:SetPrimaryPartCFrame(CFrame.new(M))A.Parent=q B.Percentage.Text=Y.."\037"B.Rarity.Text=E B.Rarity.TextColor3=G B.ImageColor3=Color3.fromRGB(55,55,55)spawn(function()local L=180 while wait()and A.Parent~=nil do U.CFrame=CFrame.Angles(0,math.rad(L),0)*CFrame.new(M+Vector3.new(0,0,3),M+Vector3.new(0,0,0))L=L+1 end end)end end end)


local l__ReplicatedStorage__1 = game.ReplicatedStorage;
local l__CurrentTarget__2 = script.Parent.CurrentTarget;
local l__PetsFrame__1 = script.Parent.PetsFrame;
function resetFrame()
	for v6, v7 in pairs(l__PetsFrame__1.Frame:GetChildren())do
		if v7.Name ~= "UICorner" then
			for v11, v12 in pairs(v7.PetView:GetChildren()) do
				v12:Destroy();			
			end;
			v7.Percentage.Text = "";
			v7.Rarity.Text = "";
			v7.ImageColor3 = Color3.fromRGB(25, 25, 25);
		end;	
	end;
end;
local u2 = require(l__ReplicatedStorage__1.Pets.Eggs);
local l__CostLabel__3 = script.Parent.CostLabel;
local l__Models__4 = l__ReplicatedStorage__1.Pets.Models;
l__CurrentTarget__2:GetPropertyChangedSignal("Value"):Connect(function()
	if l__CurrentTarget__2.Value == "None" then
		resetFrame();
		return;
	end;
	local v13 = u2[l__CurrentTarget__2.Value];
	local l__Currency__14 = v13.Currency;
	local v15 = 0;
	local v16 = {};
	for v17, v18 in pairs(v13.Pets) do
		v16[#v16 + 1] = {
			Name = v18.Name, 
			Type = v18.Type, 
			Rarity = v18.Rarity, 
			Secret = v18.Secret
		};
		v15 = v15 + v18.Rarity;
	end;
	l__CostLabel__3.CurrencyImage.Image = l__ReplicatedStorage__1.Pets.Settings:FindFirstChild(l__Currency__14 .. "Image").Value;
	l__CostLabel__3.TextLabel.Text = v13.Cost;
	table.sort(v16, function(p1, p2)
		return p2.Rarity < p1.Rarity;
	end);
	if l__Currency__14 ~= "R$" then
		script.Parent.BuyButtonR.Visible = true;
		script.Parent.BuyButtonT.Visible = true;
		script.Parent.BuyButtonE.Size = script.Parent.BuyButtonR.Size;
	else
		script.Parent.BuyButtonR.Visible = false;
		script.Parent.BuyButtonT.Visible = false;
		script.Parent.BuyButtonE.Size = script.Parent.CostLabel.Size;
	end;
	resetFrame();
	for v19, v20 in pairs(v16) do
		if v20.Secret == false then
			local l__Name__21 = v20.Name;
			local v22 = l__Models__4:FindFirstChild(l__Name__21):FindFirstChild(v20.Type):Clone();
			local v23 = l__PetsFrame__1.Frame:FindFirstChild("Slot" .. v19);
			local l__PetView__24 = v23.PetView;
			local v25 = math.floor(v20.Rarity / v15 * 10000) / 100;
			local l__Value__26 = l__Models__4:FindFirstChild(l__Name__21).Settings.Rarity.Value;
			local l__Value__27 = l__ReplicatedStorage__1.Pets.Rarities:FindFirstChild(l__Value__26).Color.Value;
			local v28 = Instance.new("Camera", l__PetView__24);
			local v29 = Vector3.new(0, 0, 0);
			l__PetView__24.CurrentCamera = v28;
			v22:SetPrimaryPartCFrame(CFrame.new(v29));
			v22.Parent = l__PetView__24;
			v23.Percentage.Text = v25 .. "%";
			v23.Rarity.Text = l__Value__26;
			v23.Rarity.TextColor3 = l__Value__27;
			v23.ImageColor3 = Color3.fromRGB(55, 55, 55);
			spawn(function()
				local v30 = 180;
				while wait() and v22.Parent ~= nil do
					v28.CFrame = CFrame.Angles(0, math.rad(v30), 0) * CFrame.new(v29 + Vector3.new(0, 0, 3), v29 + Vector3.new(0, 0, 0));
					v30 = v30 + 1;				
				end;
			end);
		end;
	end;
end);
