local block = script.Parent
local Player = game.Players.LocalPlayer
local HumPart = Player.Character:WaitForChild("HumanoidRootPart")
while true do
block.Orientation.X = HumPart.Orientation.X
block.Orientation.Y = HumPart.Orientation.Y
block.Orientation.Z = HumPart.Orientation.Z
wait()
end
✓ ANSWER ACCEPTED
npc head that follows the players position , I tried making something but it does not work?
2 answers
✓ Accepted answer
Setting the block's orientation to the player's HumanoidRootPart won't work the way you want it.
This should work:
local Block = script.Parent
local PlayerS = game:GetService("Players")
game:GetService("RunService").Heartbeat:Connect(function() --rather than using a while true do loop, I used heartbeat so there isn't as much lag
FindClosePlayer() --function is called every frame
end)
function FindClosePlayer()
for _, player in pairs(PlayerS:GetPlayers()) do -- This is just a method of getting a player from a server script
local Character = player.Character or player.CharacterAdded:Wait() --this just waits for the character (that is if the character hasn't loaded yet)
local RootP = Character:WaitForChild("HumanoidRootPart")
local Dis = (Block.Position-RootP.Position).magnitude
if Dis <= 40 then --checks distance
Block.CFrame = CFrame.new(Block.CFrame.Position,RootP.CFrame.Position) ---Using CFrame you can make the block look like it's facing the character
else
end
end
end
It's a lot but it works nicely.
if you give the block the same orientation as the player then it will look at the same thing as player not look at the player, this should generate a cframe with an orientation that looks at the player
put this in the while loop
block.CFrame = CFrame.new(block.Position,HumPart.Position)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Only thing is IT GOes beyond 90 degrees witch is REALLy weird for a head
btw his was a localscript yours is a script and if two or more players are withing distance it will work a bit weird
Its a single player game