How can you change the Cframe of a model?

How can you get the Cframe of a model?

I have tried using

local Build1 = game.ReplicatedStorage.Build1

function Clone()
	Build1Clone = Build1:Clone()
	Build1Clone.Parent = game.Workspace
	Build1:SetPrimaryPartCFrame(Build1.CFrame + CFrame.new(100, 0, 0))
end

function Generate()
	for count = 1,5 do
		Clone()
		wait(2)
		count = count + 1
	end
end

Generate()

But keep getting 19:06:18.849 CFrame is not a valid member of Model “ReplicatedStorage.Build1” - Server - Script:6
How exactly can I achieve this?

Build1 is a model, which doesn’t have a CFrame, but it has parts inside of it which do, so you would need to call :GetPrimaryPartCFrame() so you could get the CFrame of the main part of the model

Build1:SetPrimaryPartCFrame(Build1:GetPrimaryPartCFrame() * CFrame.new(100, 0, 0))
6 Likes

You have to multiply the primaryparts cframe with CFrame.new(100,0,0) because for some reason you can’t add 2 cframes together.

How would you set the primary part though?

I replied to your original post with a code snippet, look at it

1 Like