How to find a model's position? (Resolved)

Hi, I’m making a script and I found a problem, this script needs the position of a model:

local Parent = script.Parent
local Ball = workspace.ball

while true do task.wait()
	Parent:MoveTo(Vector3.new(
		Parent.???.X,
		Ball.Position.Y,
		Parent.???.Z
	))
end

but I can’t put the [“Origin Position”] in the script because my output says that Origin Position is not a valid model member.
Does anyone know what I do?

10 Likes

Models don’t have positions (or orientations or sizes), Parts do. Check out Model | Roblox Creator Documentation and Model | Roblox Creator Documentation

As thanksrobama said “models” dont have positions and the parts in it do. I would recommend you to check out the GetPivot function of the model since its pretty much same as the Origin Position thing

like this?:

	Parent:MoveTo(Vector3.new(
		Parent:GetPivot(),
		Ball.Position.Y,
		Parent:GetPivot()
1 Like

@takticiadam I’m new with programing

1 Like

GetPivot returns a CFrame which is basically Vector3 but with rotation data. Vector3.new function requires 3 arguments x y and z values of the position, we use the Cframe’s x and z value and create Vector3 with that.

Parent:MoveTo(Vector3.new(
		Parent:GetPivot().X,
		Ball.Position.Y,
		Parent:GetPivot().Z
19 Likes

Looks like it really works, thanks

1 Like

oh i thought the Origin Position could be changed, thanks.

2 Likes

Use PivotTo function to change the origin position you can also use setprimarycframe like he said.

3 Likes