I am currently working on a pet system where you can equip a pet and the pet follows you. Since I would want the player to be able to equip multiple pets, the pets would be in a circle formation so they are all visible and not be clumped together in the same position. The part where the pets follow you works, but I am stuck on how to have them in a circle formation around you like most simulator games out there.
For example: https://imgur.com/rozn5cL (4 pets) https://imgur.com/VTG1VbN (3 pets)
notice how the pets' position stay consistent in a circle according to the amount of pets
Here is the code (Server):
local Pets = script.Parent:WaitForChild("Pets") -- pets folder
while wait() do
for i,pet in pairs(Pets:GetChildren()) do
if pet:IsA("Model") then
local HumRP = script.Parent:WaitForChild("HumanoidRootPart")
local petz = pet.PrimaryPart
local BodyPosition = petz.BodyPosition
local BodyGyro = petz.BodyGyro
BodyPosition.Position = HumRP.CFrame * Vector3.new(2 + (i*3), 1, 2)
BodyGyro.CFrame = CFrame.new(pet.PrimaryPart.Position, HumRP.Position)
local amount = #Pets:GetChildren() -- the number of pets
for angle = 1, 360, (360/amount) do -- circle part
BodyPosition.Position = CFrame.new(0, 0, 0) -- idk how to do this part
* CFrame.Angles(math.rad(angle), 0, 0)
* HumRP.CFrame * Vector3.new(2, 2, 2)
wait()
end
end
end
end
What I tried doing for the circle part was go on the wiki and find a piece of code to create a circle: https://developer.roblox.com/articles/Creating-a-Circle-With-Code Then, I had modified it to fit my pets. After all of that, it still does not work and I do not know where to go for help since I have been stuck on this for the past few days now. I am not very good with CFrames and such. I hope you can help me fix this script. Thanks.
If you have any questions, feel free to ask me.

2 comments
What do you mean by that? I don't really know too much about this.
you can offset it with vector3. EG, pet.CFrame = game.Players.LocalPlayer.Character:WaitForChild("Head").CFrame + Vector3.new(2, 1, 0).