Help with Teleport

I am trying to make a script that allows my NPC to teleport. I tried to use Vector3.new to grab the position of the dummy and replicate it to the part, but it does not seem to work.

local dummyPos = game.Workspace.Dummy.HumanoidRootPart.Position
local partPos = game.Workspace.Part.Position

wait(6)

dummyPos = Vector3.new(-31, 0.5, -1)

sorry if it seems too basic

You have to change the CFrame of their HumanoidRootPart.

workspace.Dummy.HumanoidRootpart.CFrame = CFrame.new(Vector3.new(-31,0.5,-1))

or

workspace.Dummy.HumanoidRootpart.CFrame = CFrame.new(workspace.Part.Position)

Changing CFrame instead of position makes it so that the parts attached by joints and welds move with the part.

Try this:

local dummyRoot = game.Workspace.Dummy.HumanoidRootPart
local part = game.Workspace.Part

wait(6)

dummyRoot.CFrame *= CFrame.new(-31, 0.5, -1)

This worked well. Thank you for the explanation as well.