Why doesn't this work?

  1. What do you want to achieve?

I want to achieve a equip best pet button that works properly.

  1. What is the issue?

The issue is that it equips the best pets but it doesn’t show the equip marker so basically when every you equip a pet it shows like a green tick if is equiped but when I press equip best pet it doesn’t show the green tick which is called the EquipMarker it doesn’t show but it equips the pets.

  1. What solutions have you tried so far?

Finding a solution.

if script.Parent.Parent.SideFrame.Description.EquipButton.TextButton.Text == "Equip" then
				for v43, v44 in pairs(l__Inventory__32:GetChildren()) do
					if not v44:IsA("UIGridLayout") then
						v44.LayoutOrder = getLayoutOrder(v44.PetID.Value);
						--if v44.PetID.Value == script.Parent.Parent.SideFrame.PetID.Value then
						local Equipped = 0
						for i,v in pairs(l__Pets__5:GetChildren()) do
							if v.Equipped.Value == true then
								Equipped = Equipped + 1
								v44.EquipMarker.Visible = true;
							else
								v44.EquipMarker.Visible = false;
							end
							l__TextLabel__2.Text = Equipped .. "/" .. l__Data__6.MaxEquip.Value;
						end
					end;
					
					
					
				end
			elseif script.Parent.Parent.SideFrame.Description.EquipButton.TextButton.Text == "Unequip" then
				for v43, v44 in pairs(l__Inventory__32:GetChildren()) do
					if not v44:IsA("UIGridLayout") then
						v44.LayoutOrder = getLayoutOrder(v44.PetID.Value);
						local Equipped = 0
						--if v44.PetID.Value == script.Parent.Parent.SideFrame.PetID.Value then
						for i,v in pairs(l__Pets__5:GetChildren()) do
							if v.Equipped.Value == true then
								Equipped = Equipped + 1
								v44.EquipMarker.Visible = false;
							else
								v44.EquipMarker.Visible = true;
							end
							l__TextLabel__2.Text = Equipped .. "/" .. l__Data__6.MaxEquip.Value;
						end
					end
				end
			end;

Thank you in advance!