Changing a models position help

Basically I’m trying to change the position of a model however it’s erroring with unable to set double value to coordinates heres my script:

	Clone.Button.MouseEnter:Connect(function()
								local ModelClone = v:Clone() 
								ModelClone:PivotTo(0, -90, 0)
								ModelClone.Parent = game:GetService("Workspace").CarSpawnerProp.vehicledisplay
								Clone.MouseLeave:Connect(function()
									ModelClone:Destroy()
								end)
							end)
							
					
2 Likes

PivotTo requires CFrame, try changing that into PivotTo(CFrame.new(0,-90,0))

4 Likes

local PositionCFrame = CFrame.new(66.984, 2.539, 24.646)
ModelClone:PivotTo(PositionCFrame)
I changed it however, the rotation and so on is messed up

2 Likes

Mind sharing a short clip of what exactly happening?

Tho you might need to change some coordinates in your cframe

1 Like

https://gyazo.com/f144fd355764089472ae1ee837fd1218

Everything is positioning differently and rotation is different

1 Like

Have you tried first parenting it to workspace and then pivot it to that spot?
[Or check their location under their current folder ,drag them into workspace for a test and try to place them at that spot similarly, and then put them back in that folder]

1 Like

I’ve tried the first 1 however, the second option wouldn’t be viable as I’m releasing this product and I want users to be able to add their own model and then it’d pivot it.

1 Like

Seeing that the rotation is messed up you could do something like this

local targetCFrame = CFrame.new(61.726, 6.284, -164.034)
local model = script.Parent
local rot = model.WorldPivot.Rotation

model:PivotTo(targetCFrame*rot)

in your case:

Clone.Button.MouseEnter:Connect(function()
	local ModelClone = v:Clone() 
	local targetCFrame = CFrame.new(0,-90,0)
	local rot = ModelClone.WorldPivot.Rotation
	ModelClone:PivotTo(targetCFrame*rot)
	ModelClone.Parent = game:GetService("Workspace").CarSpawnerProp.vehicledisplay
	Clone.MouseLeave:Connect(function()
		ModelClone:Destroy()
	end)
end)
1 Like

The rotation doesnt work as all it does is set it to what the rotation already is but I want the rotation to essentially be the same for all models

1 Like

just change the rot value to a CFrame.Angles(math.rad(12),math.rad(16),math.rad(34))

1 Like

try using :MoveTo() instead (30)

1 Like

Still wont work i’ve tried move to and pivot

1 Like

use ModelClone:MoveTo(Vector3.new(value1, value2, value3))