Set position in range

Hello,
So basically what i want to achieve is to get the position in range (image)

If the position is out of the circle, i want to get the blue cross’ Position

I already know how to check if the position is in or out of the circle by doing

if (PositionToCheck - char.HumanoidRootPart.Position).Magnitude <= 50 then
	print("in")
else
	print("out")
end

But I don’t know how to get the position of the blue cross.
Also I’m sorry if a similar topic already exists, I couldn’t find one but it might exist because I am sure the answer is simple.
Thanks in advance !

The unit vector is a direction, so get that and multiply by the distance you would like

if (PositionToCheck - char.HumanoidRootPart.Position).Magnitude <= 50 then
	print("in")
else
	print("out")
    PositionToCheck = (PositionToCheck-char.HumanoidRootPart.Position).Unit * 50
end
1 Like

That works very well, thank you !

1 Like