Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how do i cframe a model to move or rotate?

How do I properly use [for i, v in pairs do] to cframe a model

2 answers

✓ Accepted answer

You can just use :SetPrimaryPartCFrame() method

But make sure to set it's Primary Part first.

------------------------------------

If you decide to instead use a iterator (for i, v) to loop through and rotate/move it. This is how to do it.

affectaccessories = true -- set to false if you don't want to affect hats but i added this just in case
model = game.Workspace.Model
for i, v in ipairs(model:GetChildren()) do
	if v:IsA("Part") or v:IsA("MeshPart") then
		v.CFrame = CFrame.new()
	elseif v:IsA("Accessory") and affectaccessories == true then
		if v:FindFirstChild("Handle") then
			v.Handle.CFrame = CFrame.new()
		end
	end
end

Make sure to accept my answer if it helped you!

dank memes

you could use :SetPrimaryPartCFrame() method of the model

model:SetPrimaryPartCFrame(CFrame.new(0,10,0) * CFrame.Angles(0,math.pi/2,0))

1 comment

0

Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.