PivotTo not working

I’m making a game called The Infinite Corridor and basically no matter where you go the corridor will never end, I tried to do

while true do
	script.Parent.Model:PivotTo(game.Workspace[game.Players.LocalPlayer.Name].HumanoidRootPart.CFrame)
	wait(0.01)
end
```I did this in a local script btw and it did not work any fixes?

IIRC, the function PivotTo can only be accessed by PVInstance's. Make sure your ‘model’ is a PVInstance. You can look more into this here.

I’d honestly recommend using this method instead, however.

I tried SetPrimaryPartCFrame and it didn’t work.

while wait(0.01) do
local player = game.Players.LocalPlayer
script.Parent.Model:PivotTo(player.Character.HumanoidRootPart.CFrame)
end

that should work

Actually, @V33S, I also encountered many PVInstance currently about Cframes and Vector3 and all its usages.
But, to simplify everything. I’ll just put the conclusion to using :PivotTo() and :GetPivot() here

local destination = game.Workspace.destination
local object = game.Workspace.object --can be a part or model
local Destination = destination:GetPivot() -- gives you the CFrame of the destination part in workspace
object:PivotTo(Destination)

I hope this helps you with future PVInstance problems.