Part Rotation Problems

Hello, how would I make my part rotate when it would be following the player. Right now I have this:

local Humanoid = script.Parent.HumanoidRootPart

local distance = 5

local Pet1 = workspace.Pets.Pet1
local Follower = Humanoid

local RunService = game:GetService("RunService")
while true do
	RunService.Heartbeat:Connect(function()
		Pet1.CFrame = Follower.CFrame*CFrame.new(0, 0, distance)
		Pet1.CFrame = CFrame.new(Pet1.CFrame.X, 1, Pet1.CFrame.Z)
		wait()
	end)
	wait()
end

I have tried to see if any body parts rotate along with the player but no luck. Any help is appreciated, thanks.

Firat of all, you should just use RunService.Hearbeat. The while loop is not needed. Second, you want a Part to face the Player? Use CFrame.lookAt for that

Ok, I changed the code so that there is no while true. But what would the 3/2/1 vectors be? Are there any body parts that change orientation?

I don’t understand what you’re talking about

Ok, so when I use CFrame.lookAt It tells me to add 3 vectors, I am unsure if i just place the vectors from the humanoid root part OR a different set positions. And if i were to use a different set of positions, would it be a body part that changes orientation?

Cframe.lookAt’s 3rd parameter is optional. For the first one, you’ll be using the part you want to face the player’s position, and for the second parameter you use the character’s root part position or whatever you want the part face.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.