I have a part that becomes unanchored. When it becomes anchored, the rotation isn't the same as before. What I'm trying to do is move the part to the correct rotation it was at before, but the script doesn't get it right all the time (it's off by about 90 degrees or so).
k = true while k do wait(0.01) if script.Parent.Value ~= script.Parent.Parent.Rotation then -- The script's parent is a Vector3Value which holds the rotation the part will go to and the script's parent's parent is a part. script.Parent.Parent.Rotation = script.Parent.Value end end
I checked to make sure the Value is correct, and it is. The value and the part's rotation are still different even if the script is constantly checking if it isn't. Any help on how to move the part perfectly to its correct rotation?
I don't think that you can set rotation, it should be used as read-only property. Most effective way is CFrame:
k = true while k do wait(0.01) if script.Parent.Value ~= script.Parent.Parent.Rotation then script.Parent.Parent.CFrame = CFrame.new(script.Parent.Parent.Position) * CFrame.Angles(script.Parent.Value) end end