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

How would you rotate a model?

Asked by 10 years ago

Hey guys. I have a question that needs to be answered: How do you rotate a model? I have tried the following script and put it inside a model, but it only MOVES the model, not ROTATE it.

function TransformModel(objects, center, new, recurse)
    for _, object in pairs(objects) do
        if object:isA("BasePart")then
            object.CFrame = new:toWorldSpace(center:toObjectSpace(object.CFrame))
        end
        if recurse then
            TransformModel(object:children(), center, new, true)
        end
    end
end
local Model = script.Parent
wait(3)
for i = 1,1 do
TransformModel(Model:children(), Model:GetModelCFrame(), Model:GetModelCFrame() *CFrame.new(0,math.rad(-250),0), true)
wait(0.01)
end

If anyone can help me, that would be AWESOME.

0
I believe you have to access the rotation property? Shawnyg 4330 — 10y
0
I meant a script... O_O dpark19285 375 — 10y
0
Yes, within the script. You access the rotation property and change it using Vector3. Shawnyg 4330 — 10y

2 answers

Log in to vote
-2
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

As I said, you need to use access the Rotation property by using Vector3.

Ad
Log in to vote
-2
Answered by
WXBZ 3
10 years ago
while true do
    script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0.1,0)
    wait(0.01)
end

0
You guys are all noobs... First of all, letsallgo, that will only work for a Part, not a model. Second of all, Vector3 will rotate it, but it is not accessible with CFrame. dpark19285 375 — 10y
0
if your so good at it figure it out your self i'm a begginer WXBZ 3 — 10y

Answer this question