Npc not teleporting?

The npc’s postion/cframe wont change, i set a print command to see if the function runs and it does print which means its something wrong with the cframe, here’s the code.

local newCFrame = CFrame.Angles(0, math.rad(90), 0)

local function teleport()
print("FunctionRun")
	script.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(-5.263, 4.82, -67.364)) * newCFrame
end





game.Workspace.Value1.Changed:Connect(teleport)```

try this :

local newCFrame = CFrame.Angles(0, math.rad(90), 0)

local function teleport()
print("FunctionRun")
	script.Parent.UpperTorso.CFrame = CFrame.new(Vector3.new(-5.263, 4.82, -67.364)) * newCFrame
end





game.Workspace.Value1.Changed:Connect(teleport)

you have to do UpperTorso or Torso because HumanoidRootPart will only move that part

Use PivotTo for models

local newCFrame = CFrame.Angles(0, math.rad(90), 0)

local function teleport()
print("FunctionRun")
	script.Parent:PivotTo(CFrame.new(-5.263, 4.82, -67.364) * newCFrame)
end





game.Workspace.Value1.Changed:Connect(teleport)

i use CFrame in my game and it works

Yes it works, but for future work use PivotTo. The Roblox API changes all the time, and for good reason. When a newer and better API/Approach is available, don’t stick around with the old ones.

I’m not sure about R15, but I’m very certain that modifying the HumanoidRootPart.CFrame in R6 moves every part of the character, because all Motor6ds connect to hrp.

i use R16 and it works im not sure about r6 though

when i tried PivotTo it didnt work

If you feel fancy, try scripting it again, and upload it here in a plain studio file. Then I can take a look at why it didn’t work.

i dont know maybe it dosent work on models just npcs

because i did on a model maybe that’s why

PivotTo will work on any model

oh ok plus that was on a old project