humanoid:MoveTo() for simulator

I’m currently working on a simulator and one feature of my simulator is where you harvest objects. I want it so the character moves just a couple studs in front of the object. Instead of trying to walk into the object.

I have tried humanoid:MoveTo(object.Position) and this is what I intend on using, but the only problem is humanoid:MoveTo(object.Position) is that it moves the character to the center of the object. The object I want the character to harvest has CanCollide on making the character to glitch and just keep walking into the object.

I have tried humanoid:MoveTo(object.Position - Vector3.new(0,0,12)) and a few other Vector3 values but the problem is it will move to the other side of the object. I want the player to stop in front of the object in the direction they are facing.

Thank you! any help would be appreciated :slight_smile:

1 Like

You could set the characters LowerTorso to the position of the object, then - or + a Vector3.new value. (Not tested so it might not work.)

Try this:

local rootPos --HumanoidRootPart.Position
local human --Humanoid
local objPos --object.Position
local offset = 3 --Distance of separation

local pos = CFrame.new(rootPos, objPos) * CFrame.new(0,0,-offset)
human:MoveTo(pos.p)

Hi ,ancadejo10

The only problem with this is that it moves the player just the value of offset closer to the object.
What I was looking for was even if you were 20 studs away or 9 studs away you would move to around 7 studs away from the object.