Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i cframe a model to move or rotate?

Asked by 7 years ago

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

2 answers

Log in to vote
0
Answered by 7 years ago

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

Ad
Log in to vote
1
Answered by 7 years ago

you could use :SetPrimaryPartCFrame() method of the model

model:SetPrimaryPartCFrame(CFrame.new(0,10,0) * CFrame.Angles(0,math.pi/2,0))
0
Thanks LastApollo 76 — 7y

Answer this question