Its kinda in the title but what I want to do is clone a model filled with parts (I will need to access each part of the model) and changes its position. (the model’s position). There seems not to be a position property on a model even when I set a primary part.
You need to use MoveTo or SetPrimaryPartCFrame. The difference between the two is that MoveTo changes the model’s position with a Vector3s, while SetPrimaryPartCFrame changes the model’s position and orientation with a CFrame
local model = script.Parent
model:MoveTo(Vector3.new(0, 10, 0)) -- move 10 studs up in the y-axis from the origin
model:SetPrimaryPartCFrame(CFrame.new(0, 20, 0) * CFrame.Angles(0, math.rad(45), 0)) -- move 20 studs in the y-axis from the origin and rotate 45 degrees in the y-axis
Update: Note that SetPrimaryPartCFrame is deprecated in favour of the PivotTo function based on the model’s pivot offset
model.PrimaryPart = --specific part here (you can also set this in the properties window)
--then do something like:
model:SetPrimaryPartCFrame(CFrame)
EDIT: Please note that with SetPrimaryPartCFrame() you can move your model inside of something (good or bad depending on use case), but if you want to avoid this please use Model:MoveTo(Vector3) as @Raretendoblox has said. MoveTo moves it up until it no longer collides with anything
Mine isn’t.
In my scenario, this moves only the primary part.
I’m personally trying to move a model out of replicated storage and into Workspace, but it will only move the primary part.