Collapse Sidebar


Transforms the PVInstance along with all of its descendant PVInstance|PVInstances such that the pivot is now located at the specified datatype/CFrame. This is the primary function that should be used to move Model|Models via scripting.

BasePart|BaseParts are moved in this way by having their datatype/CFrame transformed by the necessary offset. Model|Models are moved in this way by having their Model/WorldPivot transformed by the necessary offset.

Note that for efficiency purposes, Instance/Changed events are not fired for BasePart/Position|Position and BasePart/Orientation|Orientation of BasePart|BaseParts moved in this way; they are only fired for datatype/CFrame.


Name Type Default Description

The datatype/CFrame that the PVInstance pivot should equal after moving it.


Return Type Summary

Code Samples

Simple Character Teleportation

This code sample is a simple teleport script that moves your character 10 studs forwards in the direction you’re currently facing when you press the F key. It does so by getting the current pivot with PVInstance/GetPivot and calling PVInstance|PivotTo to move the character forwards.

-- This code should be placed in a LocalScript under StarterPlayerScripts
local Players = game:GetService("Players")
local ContextActionService = game:GetService("ContextActionService")

local function doTeleport()
	local player = Players.LocalPlayer
	local character = player.Character
	if character and character.Parent then
		-- Move the character 10 studs forwards in the direction they're facing
		local currentPivot = character:GetPivot()
		character:PivotTo(currentPivot * CFrame.new(0, 0, -10))

ContextActionService:BindAction("Teleport", doTeleport, true, Enum.KeyCode.F)