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

Any way I can make a BodyPosition go in front of a player?

So earlier I was making a boomerang tool and I fixed a few errors before I wanted to get to this part. I am using a BodyPosition to make the boomerang fly forwards. I tried using LookVector but I'm not sure how that would work in this situation.

Tool = script.Parent

function onActivated()
    wait()
    Tool.Handle.BodyPosition.position = Tool.Parent.Torso.Position + Vector3.new (20,0,0)-- I want this to be 20 studs away from where the Player is faceing but I don't know how.
    Tool.Parent = game.Workspace
end

Tool.Equipped:connect(onActivated)

Thanks! ~Minikitkat

5 comments

0

That doesn't make sense, BodyPosition goes into a part.

0

The bodyPosition is in the handle. I am making the handle use the BodyPosition to go infront of the player. Also why is this marked as a bad post. It didn't break any rules!

0

Oh ok, (read roblox message, dont bother with the second paragraph) This won't work because the "handle" is connected to the player. So the body position will move the entire player.

0

It works because I tested it and it makes the tool go into the workspace and go to the position but I need it to go directly infront of the player. not just somewhere on the X axis

0

Ohh, I have no clue how to get the direction a player is facing, sorry

1 answer

✓ Accepted answer

If you have a lookVector (ex of the user's torso), simply multiply it by the magnitude you want (20 in this case) and add it to the player's torso's position:

Tool.Handle.BodyPosition.position = Tool.Parent.Torso.Position + Tool.Parent.Torso.CFrame.lookVector * 20

1 comment

0

Oh I see! I was putting something completely different. Thanks!!!

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