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

How Do You Prevent a Cylinder Part From Rotating? Help!

Asked by 9 years ago

I placed this script in the cylinder part:

function onTouched()
    script.Parent.CFrame = CFrame.new(script.Parent.Position.X, script.Parent.Position.Y - 0.2, script.Parent.Position.Z)
end

script.Parent.Touched:connect(onTouched)

When I touch the cylinder part, it's rotation goes from (0, 0, -90) to (0, 0, 0)! How can I prevent this? Thank you!

0
This script is not the source of the problem, simply show all the scripts. Wutras 294 — 9y
0
Yes it is. You missed it. 1waffle1 2908 — 9y

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

You are setting its CFrame. The CFrame you are setting it to does not have a rotation. Multiply it by CFrame.Angles(0,0,-math.pi/2) to add the (0,0,-90) rotation.

Ad

Answer this question