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

What am I doing wrong with this Vector3 math?

char:MoveTo((Lobby.Position * Vector3.new(math.random(-2, 2), 0, math.random(-2, 2))))

Without the * Vector3.new(stuff), this works just fine, teleporting the char to Lobby. But with it, it teleports the char to the middle of the map instead, near Vector3 0,0,0. I've used Vector3 before and i'm pretty sure multiplying a position by a vector3 means ''position plus these coordinates'', not ignoring the position entirely. I'm a bit rusty, so what am I doing wrong?

2 answers

✓ Accepted answer

Vector3s can be added normally. CFrames are multiplied to perform a translation because they are matrices and not coordinates.

char:MoveTo((Lobby.Position + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2))))

This should work. :)

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