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

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

Asked by 4 years ago
Edited 4 years ago

https://gyazo.com/2a5e18c3fe530033b704c66d107488d3 The link above contain the script and the output. I would like it if you guys can help me on this.

0
It won't let me see the whole script :( Heavenlyblobmaster 271 — 4y
0
Thats because you cannot add a vector3 without a cframe. JesseSong 3916 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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.

Ad

Answer this question