Hi, I’m trying to rotate my pets to a certain object however only 1 out of the 4 pets rotated in the desired direction. I noticed the 2nd pet needs to rotate 90 degrees to reach the desired direction, the 3rd needs to rotate 180 degrees and the 4th needs to rotate 270 degrees. However I’ve been getting this error: CFrame expected, got Vector3.new()
for _, petInTable in pairs(petsEquippedTable) do
for i, pet in pairs(character:GetChildren()) do
if pet.Name == petInTable then
local index = 0
local angle = circle / MAX_PETS * i
local x_pos = math.cos(angle) * radius
local y_pos = math.sin(angle) * radius
local attachmentCoin = Instance.new("Attachment",coin)
attachmentCoin.Position = Vector3.new(x_pos, 1, y_pos)
attachmentCoin.Visible = false
local alignPosPet = pet:FindFirstChild("AlignPosition")
alignPosPet.Attachment1 = attachmentCoin
local alignOrPet = pet:FindFirstChild("AlignOrientation")
alignOrPet.Attachment1 = attachmentCoin
pet:SetPrimaryPartCFrame(CFrame.new(pet.PrimaryPart.Position + CFrame.Angles(math.rad(index*90),0,0),coin.Position))
index+=1
end
end
Well I’m not actually using the LookAt() function because there is none within a model. This is how you change the .LookAt CFrame of a model which I am using: