I am not very good at drawing or explaining things but here is the code you need tor calculating where to put the targets.
local restPosition = --Here you put the position for the leg on the rest position. I usually use a raycast down from an attachment to signal the rest position
local maxDistanceFromRestPosition = --Here you put the maximum distance that the leg will be from the rest position
local footPosition, movementDirection = nil,nil
while true do -- Any update method here will be better
footPosition = --Get the foot Position
movementDirection = --Get the unit vector for the direction of movement for the player
if (restPosition - footPosition).Magnitude > maxDistanceFromRestPosition then --If the foot is far from the rest position
local footOffset = --Get the offset of the foot from the target you can do this by making a CFrame:ToWorldPosition or by manually subtracting the values. You do not need the Y value
TweenPosition(foot,footPosition,targetPosition - footOffset)
-- Or TweenPosition(foot,footPosition,footPosition - (2 * footOffset))
-- Or TweenPosition(foot,footPosition,targetPosition + (movementDirection * maxDistanceFromRestPosition)
end
end
This is not real code so it will not work as is so you have to “adapt it” to your own needs. The code is just a guidline of what you can do
In other words you need to update your targets position based on either the direction of movement of the player or by getting the offset of the foot and offset target from the player accordingly