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?
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)
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?