Need help NPC's body follows player?

So I am trying to make it so an npc’s body follows the players HRP, but it does not work, any help?

local re = game.ReplicatedStorage.RobClothes

boi = false

local UpdateSpeed = 0.5

local Core = workspace.GunNPC:WaitForChild("HumanoidRootPart")

TurnCharacterToMouse = false

re.OnServerEvent:Connect(function(Player)

if TurnCharacterToMouse == false then

TurnCharacterToMouse = true

game.Workspace.GunNPC.RobbedShooting.BR.Value = true

if TurnCharacterToMouse == true then

Core.CFrame = Core.CFrame:lerp(CFrame.new(Core.Position, Vector3.new(Player.Character.HumanoidRootPart.Position, Core.Position.Y, Player.Character.HumanoidRootPart.Position)), UpdateSpeed / 2)

end

end

end)
1 Like

This remote event would have to be called every frame to work. Also, your second if statement does nothing (always true).

1 Like

So I have this in a server script. And it does not work, any help?

while true do

Core.CFrame = Core.CFrame:lerp(CFrame.new(Core.Position, Vector3.new(Player.Character.HumanoidRootPart.Position, Core.Position, Player.Character.HumanoidRootPart.Position)), UpdateSpeed / 2)

end