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

A small problem?[SOLVED after 35 minutes] [closed]

Asked by 9 years ago
while wait(0.1) do
    local rot = script.Parent.Rotation
    rot = Vector3.new(rot.x,rot.y+1,rot.z)
    script.Parent.CFrame = CFrame.new(-511.8, 13.703, -325.1)   
end

Doesn't turn for some reason...

UPDATE: In Run mode, I try to rotate it with the rotate tool and the rotation value keeps going back to 0, 0, 0.

Locked by Redbullusa, RaverKiller, TurboFusion, and adark

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
1
Answered by
Redbullusa 1580 Moderation Voter
9 years ago

I wouldn't recommend using CFrame and Vector3 properties and constructors together. I would choose one or the other. I prefer CFrame because Vector3 properties have a built-in collision check, and it checks whether or not the part will go through another part.

If the part does go through another part, then the former part will be placed on the area without any chance of colliding with other bricks on top.

Vector3

while wait(0.1) do
    YValue = script.Parent.Rotation.y
    script.Parent.Rotation = Vector3.new(0, YValue + 1, 0)
end

CFrame

Use the Angles method.

while wait(0.1) do
    script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0, math.rad(1), 0)
end

I would recommend using it's own CFrame, then 'add' (or multiply) the angles of its CFrame by it.

Notice how I used the math function "math.rad()". That is because CFrame is in radians, and I find it a lot easier to convert my intended degrees as the argument for the rad method.

Ad