Help with pets system

In the pet folder, there is a IntValue named “Stat” that gets the stat(x3 coins) from the module script.

I wanted to, if you press “Equip Best” Button, the game equip you the best pets you have in your inventory, that’s it.

Thanks!

So what makes a pet the “best”? If it’s their Stat then replace Fitness in my example script with Stat

Did that, but there is the same error.

Thanks!