Hello Guys!
I wanted to republish this topic because nobody saw it XD!
So recently I started a simulator game and I wanted to implement the pet system, I already made everything, from the hatching system to the rarities etc
But I found a problem with my script.
I made a script that makes the pet follow the player like the famous simulators, the circle method, but when I equip a pet or more it look kinda bugged.
I want that if u have one pet equipped then it is going to follow you from behind but when you more than one equipped it follows you divided in a circle of 360 degrees
Can someone help?
Here's the code inside of each pet
--ALL THE FOLDERS ARE INSIDE OF THE PLAYER'S HUMANOIDROOTPART
local pointsFolder = script.Parent.Parent.Parent.Points
local petsFolder = script.Parent.Parent
while wait() do
for i,v in pairs(petsFolder:GetChildren()) do
if pointsFolder:FindFirstChild("Point"..i) then
local HRP = script.Parent.Parent.Parent
pointsFolder:FindFirstChild("Point"..i).CFrame = HRP.CFrame * CFrame.Angles(0,(360/#script.Parent.Parent:GetChildren()) * i, 0) * CFrame.new(0,0,5) -- CHANGES THE POINT CFRAME
v.PrimaryPart.CFrame = pointsFolder:FindFirstChild("Point"..i).CFrame -- CHANGES THE PET CFRAME
else
local HRP = script.Parent.Parent.Parent
--THIS CREATES A NEW POINT
local part = Instance.new("Part")
part.Transparency = 1
part.Anchored = false
part.CanCollide = false
part.Anchored = true
part.Name = "Point"..i
part.Parent = pointsFolder
part.CFrame = HRP.CFrame * CFrame.Angles(0,(360 / #script.Parent.Parent:GetChildren()) * i, 0) * CFrame.new(0,0,5) -- CHANGES THE POINT CFRAME
v.PrimaryPart.CFrame = part.CFrame -- CHANGES THE PET CFRAME
end
end
end
Here is the video of what happens
Unfortunately I can’t upload any videos rn… It says it doesn’t work XD