of     1   

i kill
#59197209Wednesday, December 07, 2011 12:15 AM GMT

Hi, I am attempting to move a brick from one spot to another via a BodyPosition. I am using the script I wrote below to go through each Vector3 until the end. I am struggling with one part though, I need to 'repeat wait()' the for loop until the brick is at the vector. Is there anyway to do this with magnitude? I've never studied magnitude very much and hope some expert out there can give me some pointers. Thanks. for _, v in pairs(points) do print("Going to: " .. tostring(v)); game.Workspace.Model.Torso.BodyPosition.position = v repeat wait() until math.floor(game.Workspace.Model.Torso.Position) = v end
MrgamesNwatch
#59197428Wednesday, December 07, 2011 12:18 AM GMT

you could do something like repeat wait() until Position.x == 100 and position.y == 5 and position.x == 100 which would wait until its at the position 100,5,100
i kill
#59197544Wednesday, December 07, 2011 12:19 AM GMT

@MrgamesNwatch, no. It must use magnitude as BodyPositions don't position a brick exactly where you want it to go. And what I had in my script is exactly what you just wrote except longer. GOBWEY unless you know how to help.
i kill
#59197627Wednesday, December 07, 2011 12:21 AM GMT

And yes, I know math.floor() doesn't work on Vectors. I was using it for a math thing I had in there before and forgot to remove it.
MrgamesNwatch
#59197926Wednesday, December 07, 2011 12:25 AM GMT

BodyPostion should take the object to the set postion, so long as its strong enough. so ummm.... for _, v in pairs(points) do print("Going to: " .. tostring(v)); game.Workspace.Model.Torso.BodyPosition.position = v repeat wait() until (game.Workspace.Model.Torso.Position - v).magnitude == 1 end something like that... though what is 'v' supposed to be exactly?
SCARFACIAL
#59198589Wednesday, December 07, 2011 12:34 AM GMT

He probably has something among the lines of the following table: local points = { Vector3.new(0,1,1); Vector3.new(7,1,2); Vector3.new(5,0,1); Vector3.new(6,3,4); } Assuming v is indeed a Vector3 value, your statement should be fine, but I'd advice against using an exact value for .magnitude. That's harder to get than the exact position. repeat wait() until (game.Workspace.Model.Torso.Position - v).magnitude <= 1 "I WILL GIVE YOU BACON." - Deadmau5 ~Scarfacial
i kill
#59199031Wednesday, December 07, 2011 12:41 AM GMT

@Scar, thanks. +Rep (If I could ;P)

    of     1