BodyPosition on Dummy and Player act differently

https://gyazo.com/37bbaedccec91b3cee276125f395b160

local function newForce(obj: BasePart, relativePos: Vector3, completionDistance: number)
    local objPos = obj.Position
    local worldPos = objPos + relativePos

    local bp = Instance.new("BodyPosition")
    bp.MaxForce = Vector3.new(1, 1, 1) * math.huge
    bp.Position = worldPos
    bp.Parent = obj

    while (obj.Position - objPos).Magnitude < completionDistance do task.wait() end

    bp:Destroy()
    obj.AssemblyLinearVelocity = Vector3.new()
end

...

task.spawn(newForce, attackerRoot, Vector3.new(0, 55), 14)
task.spawn(newForce, defenderRoot, Vector3.new(0, 55), 14)

For some reason, even though the relative positions and completion distances are the same, the dummy stops before the player. This is not a desired outcome. If remove the obj.AssemblyLinearVelociy = Vector3.new() though it sometimes works. If anyone knows what’s going on here please let me know, thank you.

Hi. Did you try to use ReachedTarget instead of the while loop? In that case, there is still a 0.1 stud margin.

Also, is there a reason why you are using BodyPosition instead of Humanoid:MoveTo?

1 Like

I’m not using reached target because with the way I’m doing it I can change the speed of the body position. About the not using :MoveTo(), I guess I just hadn’t thought of that yet. I’ll try it and see if it changes anything, thanks for the suggestions.