How can I make equipped pets appear first?

How would I make it so that the pets that the user has equipped appear first?

I believe you are using a UIGridLayout, so you can order them with their LayoutOrder property. Equipped with 1, 2, or , 3. The others with 4+.

2 Likes

You could get the children and then set the layout order depending on if they are equipped are not.

Example script:

local PetContainer = -- Get the frame that holds the pets

for Number, Frame in ipairs(PetContainer:GetChildren())

    if Frame:IsA("Frame") then -- Change to whatever you want to check

    if Frame.Equipped.Value == true then -- Detect if it's equipped [Change it so it does it your way]

        Frame.LayoutOrder = 1

    else

        Frame.LayoutOrder = Number

    end

end

Thank you for the example, Ill use that, but should I make a dictionary like in this here because I also want the best pets to be displayed first

Maybe. If I may ask did you use a tutorial for this system such as polarisprog’s tutorial?

I did, but I made some modifications to it because his tutorials for this system wasnt an entire system. I have not watched his multipliers or deleting video yet.

I did his entire system, I made it so you can make secrets that are lik 1 in 1 million [rather than lowest being 1 in 100], Pet sorting [Equipped first, then strongest to weakest] and change some egg functions

what ive done so far, is modify the rarity system like you did, I have made UUID stuff to prevent duping, and stuff like that