I have a part that becomes unanchored. When it becomes anchored, the position isn't the same as before. What I'm trying to do is move the part to the position it was at before, but this script doesn't move it all the way; it's off by about 0.2 studs on at least 1 axis all the time.
k = true while k do wait(0.01) if script.Parent.Value ~= script.Parent.Parent.Position then -- The script's parent is a Vector3Value which holds the position the part will go to and the script's parent's parent is a part. script.Parent.Parent.Position = script.Parent.Value end end
I checked to make sure the Value is correct, and it is. The value and the part's position are still different by 0.2 or so, even if the script is constantly checking if it isn't. Any help on how to move the part perfectly to its correct position?
k = true while k do wait(0.01) if script.Parent.Value ~= script.Parent.Parent.Position then script.Parent.Parent.CFrame = CFrame.new(script.Parent.Value) end end
Don't forget the commas in the IntValue, X, Y, Z
And this is your lesson, CFrame is ALWAYS used when doing somethings with Position and Rotation