A friend and I are working on a pet system. Whenever he spins his avatar, the pets move with him, which is something that we don’t want. Any tips/solutions would be appreciated, thanks!
while wait() do
local index = 0
for n, k in pairs(plr.equipFolder:GetChildren()) do
if k.petID.Value == chosen.petID.Value then
index = n
end
end
local fullCircle = 2 * math.pi
local radius = 15
local function getXAndZPositions(angle)
local x = math.cos(angle) * radius
local z = math.sin(angle) * radius
return x, z
end
local angle = index * (fullCircle / #plr.equipFolder:GetChildren())
local x, z = getXAndZPositions(angle)
local position = (HRP.CFrame * CFrame.new(x, 0, z)).p
local lookAt = HRP.Position
local goal = {CFrame = CFrame.new(position, lookAt)}
local petMove = TweenService:Create(chosen, TweenInfo.new(task.wait(), Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), goal)
petMove:Play()
end