Pet grid system

Hey there! So, i want to create a pet grid system, i already have a system to follow the player using BodyPosition.

How would i create a pet grid system like pet simulator x? Like separating them like a grid but still following the player.

How would that be possible?

Thanks!

BodyPosition has been deprecated so shouldn’t be used for new work, see documentation here BodyPosition.

Try this:

local row_count = 4;
local spacing = 2;
local start = -(row_count/2)*spacing;
local x_off = start;
local z_off = 5;
local count = 0;

for _, pet in pairs(pets) do

	if count > 0 and count%row_count == 0 then

		z_off += spacing;
		x_off = start;

	end

	-- use x_off and z_off in BodyPosition.Position

	x_off += spacing;
	count += 1;
	
end
1 Like

Could you explain to me a bit on how this works? So i can modify it a little if i need to, im kind of confused on how this works by itself. Thanks

(Sorry if im asking too much :sweat_smile:)

IGU here’s some of my old code bro it wont make sense but take what u can

-- the pet is a subsidiary
local rowPos = -(3 * self.TotalRows+ 3) / 2 + 3 * self.RowPlacement
UploadPacketResponse.subsidiaryOffset = CFrame.new(rowPos, 0, 3.25 * (self.Row))
1 Like