Oh dont worry about it sorry it took me so long to respond!
for the row it works like this:
Loopnumber % objects_per_row
meaning the item number we are currently editing divide by the number of objects per each row
and modulus is a little weird ( only returns with the remainder so if you do 5%2 this will do 2 ( 2’s ) can go into 5 , but 1 is leftover
( this one is now the result of the modulus or ( % ) )
if the item number evenly goes into the objects per row then
just give me the item number / objects per row
othewise give me the ( item number / objects per row ) without the decimal then add one ( its our row count ) it just works ? I mean you can write it down or something it will probably make more sense that way ( you can try some examples )
Object number is supposed to be the spot in the row ( basically if we are number 8 and each row is 3 then the object number is supposed to be 2 )
its quite similar ( item number % objects per row ) all i did to make sure if it was 3 and the number per row is 3 then it wont be 0 ( 3/3 has no remainder )
The main thing that happens in pet position is it merges all of the vectors to place the pet at the new location.
The vector for complete left ( thats on the first row and behind the player and as far left as possible ) if you are looking forward
then we add rows, but we have to make sure we are adding a vector based on the behind the player ( so we multiply it by the behind the player vector and the row count then make sure we update it to the space between rows.
Now we want to center the pets behind the player using the right vector ( so we do something similar to the rows ) so we take right_vector and multiply it by the pet number ( for the row → object number ) and multiply the space between pets
FINALLY we want to move the pet to the actual position so we set the CFrame for the object to a lerped cframe ( a position between two points ) so the first position is the current position of the object
then we have a second position ( the PET POSITION!! ) and we just go about ~0.2 from the old position to the new position with ( 0.9 * delta * 5 )
delta is the time between frames, but it is usually 0.02 if you have around 60 frames in game
you can increase the speed or decrease it by changing how much you multiply 0.9 and delta
you could also modify 0.9
Dont worry about asking too much I had fun making this!
let me know if you have any other questions.