I am trying to make pet( the pet is model with primarypart) but, I need to make it rotate where you look. I don't know how and I am asking for help.
Code :
local Pet = script.Parent
local Move = script.Parent:WaitForChild('Move')
Move.OnServerEvent:connect(function(Player)
if workspace[Player.Name] then
local Head = workspace[Player.Name]:FindFirstChild('Head')
if Head then
Pet:SetPrimaryPartCFrame(CFrame.new(Head.CFrame.X + 1,Head.CFrame.Y + 2,Head.CFrame.Z + 1))
Pet:SetPrimaryPartCFrame(Pet.Hitbox.CFrame * CFrame.Angles(0,Head.CFrame.lookVector.Z,0))
end
end
end)
Please help!

9 comments
Hello, thanks for help. But when I use this code it throws error "Unable to cast Vector3 to CoordinateFrame".
Oh wait, lemme fix that.
There, it should work now.
It stil doesn't work. No error but the pet is rotated wrongly, and it stays in the rotation and doesnt do anything else.
The pet is just frozen in wrong rotation
Look https://gyazo.com/4c8866ff78ac4bf7b03a18db488998f2
That's probably happening because the PrimaryPart's Front face is messed up. Make a new part and make it's front the front of the Pet. In Models, the sides don't act similarly, so you need to make sure you make your own front. https://www.youtube.com/watch?v=aHzfAoXdeXs&list=UUluMbZrto7C1iQVKMTXLGWw&index=20 This youtube video shows you how I made my own pet system.
Thanks very much.
No problem. Glad to help.