I made a script that's supposed to make an object have a constant rotation of (0, 0, 0), but it's not working right. Here's the script:
while true do
wait(0.1)
if script.Parent.Parent.Rotation ~= Vector3.new(0, 0, 0) then -- script.Parent.Parent is a part
script.Parent.Parent.Rotation = Vector3.new(0, 0, 0)
script.Parent.Parent.CFrame = CFrame.new(script.Parent.Parent.Value.Value) -- position the object to where it belongs (script.Parent.Parent.Value is a Vector3Value)
end
Other important info: the part has a constant motion of 10 with a BodyVelocity.
The problem with this is that the script, even if the part's rotation is (0, 0, 0), still plays and locks the part into a fixed position because the script keeps looping. I'm wondering what's wrong with this script, because to me it's fine. There's no errors in the output. Any help?

9 comments
I left a comment for you as another answer to put my script into lua format.
I updated it. That should work...
Hm, there's still a problem of the part being locked in place because of the script repeating. I'm going to need another if then statement like "if script.Parent.Parent.Rotation ~= Vector3.new(0, 0, 0) then", but that doesn't work. I really appreciate all your help, by the way.
Your welcome, but I have to go in a moment, so I probably won't be able to respond again until tomorrow, but I won't give up on this. Could you try to explain to me what your script is supposed to be doing exactly?
All it's supposed to do is keep a part's rotation at (0, 0, 0) without having the part lock up.
Oh, well that's a simple fix, I'll update the script.
Should work now. If not, then Idk what the heck is wrong
Finally! It works now. Thanks for all the help.
Haha, no prob! Sorry it took so long to fix the problem.