How to get all parts in a model to follow PrimaryParts rotation?

Okay, then call newmodel:SetPrimaryPartCFrame(oldModel:GetPrimaryPartCFrame())

Why do you need a new model from the replicated storage instead of just selecting the one currently in the workspace?

Because the code eventually calls a remote event to the server, which is what gets the model from the repstorage and places it properly. If I had 100 items with the same name inside workspace then the serverscript would just pick the first one instead of it being the actual one i clicked.

You can pass instances over the remote event. You can directly tell the server which model you clicked on. Each entity in the world has a unique ID internally so events can get replicated from the server to the client, and the client can send instance IDs back over to the server. That way you can avoid all of this. ^.^ But my solution above should work anyways.

if rotation then
	dummyModel = items[itemName.Name]:Clone()
	dummyModel:SetPrimaryPartCFrame(itemName:GetPrimaryPartCFrame())
	currentItemName = itemName.Name
else
	dummyModel = items[itemName]:Clone()
	currentItemName = itemName
end

Just tried using :GetPrimaryPartCFrame() and it still rotates them 180 degrees :confused:

Unfortunately I don’t know what the items dictionary is, nor itemName. I’d need more to debug it. Is itemName always the old model? Why is it in an if statement? It should always have the same rotation.

itemName is the model itself (so itemName.Name is the items name)

I suspect this might be to do with the rotation part of your placement code, ie when you have an item you are moving the way you can rotate it deliberately. It’s easy to have the current rotation set to a global which re-rotates when you select something new rather than being reset to 0.

Also you would want the CFrame of the object you are clicking on, not the version of it in items.

As a side note, you may also be interested in the Dragger service. Dragging parts is a common enough operation they decided to make a service for it ^.^

Ok I used this:

dummyModel:SetPrimaryPartCFrame(itemName:GetPrimaryPartCFrame():inverse() * dummyModel:GetPrimaryPartCFrame())

and for some reason, it doesn’t rotate the model if the model’s rotation is either 90 or -90 (Y), but when it’s 0 or 180 it doesn’t work.

For reference, the 4 rotations of the primary part are 0, 90, 180, -90 (I don’t know why -90, blame roblox XD)

Are you sure itemName is always the correct model? If you try removing it in the initialize position function, does it remove the right model? Is it possible that you are setting the old model’s Primary Part’s CFrame elsewhere, causing it not to be the same as the one stored in items? Does it work when you have placed a model but never rotated it? Can we see the rotation code?