Using MoveTo:() on model doesn't move to the set position

Hello I am trying to move a model using “MoveTo” the issue is that it doesn’t move the part where I want it to be. Here is my code :

	local NewModel = RepStorage.Asset:WaitForChild("QUIZTEMPLATE"):Clone()
	local NEWPOSITION = Vector3.new(-3295.900634765625, 5, -35.952999114990234)
	
	print(NEWPOSITION)
	
	NewModel:MoveTo(NEWPOSITION)
	
	print(NewModel:GetPivot())

Output :

As you can see they aren’t the same positions at all when it should be, (I am only looking for the first 3 values because the rest is the orientation.), It works perfectly fine with a part, I just don’t get why it is that far from the NEWPOSITION value.

:MoveTo() has collisions. :PivotTo() is what you’re looking for. It’s confusing, I know.

I didn’t want to use PivotTo as I’d also have to put the orientation, I just have no idea how to construct a cframe with different XYZ values but the same orientation, because I tried PivotTo and it was at the right position just not the good orientation :

	local GridOffset = 100
	local TargetPart = XPositions[#XPositions] 
	local TargetXPosition = TargetPart.TargetPart.Position.X - GridOffset :: number
	
	local TargetCframe = TargetPart.TargetPart.CFrame :: CFrame
	
	local MOVEPOSITION = CFrame.new(TargetXPosition, TargetPart.TargetPart.Position.Y, -35.953) -- Here I need the full orientation of "TargetCframe"

You need to use PivotTo. If you don’t want the orientation then just do: Model:PivotTo( CFrame.new(Position) * Model:GetPivot().Rotation )

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.