trying to get a NPC's head to follow the player and also be able to animate/move. however, when i use this script, the entire body moves (the head is bound to the torso, is that an issue? i don't think so) instead of just the head and the NPC cannot move or animate. "look" is used to default NPC back to position. this may be the issue, as it must default to look a certain direction, but clarification would be sweet.
stats for bodygyro: D = 350, MaxTorque = 2000,2000,2000, P = 3000
stats for bodyposition: D = 1250, MaxForce = 4000,4000,4000, P = 10000, and Position = 0,50,0.
script is below.
local head = script.Parent.Parent.Head local bgyro = head.BodyGyro local bposition = head.BodyPosition local studsaway = 15 local look = game.Workspace.PellyLook bposition.Position = head.CFrame.p while wait() do for _, v in pairs(game.Players:GetPlayers()) do local character = workspace:WaitForChild(v.Name) if character then local distance = (head.CFrame.p - character.PrimaryPart.CFrame.p).Magnitude if distance <= studsaway then bgyro.CFrame = CFrame.new(head.CFrame.p, character.PrimaryPart.CFrame.p) break else bgyro.CFrame = CFrame.new(head.CFrame.p, look.CFrame.p) end end end end