Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My line of script got a bad argument #2 (Vector3 expected, got CFrame). Any ideas?

1 answer

✓ Accepted answer

Minor issue: You have a typo where it should be Magnitude.

In this case, the error is quite literal. You cannot Add/Subtract 2 CFrames together, so when it sees a CFrame +/- ( A thing), it expects that thing to be a Vector3. Beyond that, however, you cannot call Magnitude on a CFrame, because it is a complicated object, not simply a vector. If you want the distance between two objects, and you have their CFrames, you can do (Object1CFrame.Position - Object2CFrame.Position).Magnitude instead.

This discussion is preserved as it was. New answers, comments, and votes are closed.