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

What event would this be?

How would I get the rest of the script to execute when a brick reaches the "goal" position in it's BodyPosition?

1 answer

✓ Accepted answer

There is not an event for this (for a few reasons).

BodyPositions will (ideally) never quite get the object to the target location. It will usually only limit towards the target position. This means that there is simply some radius that you deem as acceptably close -- however, depending on circumstance, your tolerance could be very different.

In addition to being close in position to the target, however, the object should also be low in velocity, as an object may approach a point but continue through due to high inertia (depending on the application this may not matter).


A check to determine if an object is near the target (within a radius) would look like this:

if (bp.position - bp.Parent.Position).magnitue < radius then

However, there is no choice other than to continuously check this (RenderStepped offers the highest frame rate)

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