How do i make my model look at me?

Ok so imma go straight to the point


so i got my boy sans here, hes a rig, he works perfectly and can do whatever rigs can do, but i was wondering how can i make him look at me?
image
do i have to use BodyGyro or Align Orientation?, im currently learning how to script so i might not understand too much but i really need to understand how do i make him look at me

ya guys know how could i make this?

(ignore the animations folder its for the game im working on)

Maybe CFrame.lookAt, or you want other thing?

I recommend you use body turn I tell you that it is effective but you would have to use a while loop

This is basically the bare method

You need to find the closest player to the model(optional), and then point the head towards it.

--server script
local head = [model head part here]

local function findClosestPlayer()
	local biggestDist = 0
	local closestChar = nil
	for i, v in pairs(plrs:GetChildren()) do
		repeat task.wait() until workspace:FindFirstChild(v.Name) or v.Character
		local character = v.Character
		
		local charHead = character:WaitForChild("Head")
		local dist = (head.Position - charHead.Position).magnitude
		if dist > biggestDist then
			biggestDist = dist
			closestChar = character
		end
	end
	
	return closestChar
end

while true do -- can also wrap it around a stepped loop
    local char = findClosestPlayer()

   local head = char:FindFirstChild("Head") --Changeable to whatever part of the character you want
   
    local lookPos = head.Position
    head.CFrame = CFrame.lookAt(head.Position, lookPos)

    task.wait()
end

Here is an example of how this can be used:

As you can see, when I pull out the bubblegum tool, the model’s head follows me, but as soon as I unequip the bubblegum tool, the head stays in place

This is my dev forum account that’s why the user is different in the video btw

Hello!, im trying to find out how to move my models humanoidRootPart so it looks like the whole model is moving, i assume its mostly the same way right?

Yes, it’s the same thing except you just have to change the head variable to the humanoidRootPart

Hey @Alonso_lel , If the solution I gave above is right, can you please mark it as a solution and close this topic? Thanks.

opps sorry i forgot about that, and hey thanks it worked

1 Like

No problem!

(Character limit)

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