I'm scripting a monster and want it so that the monster moves towards the nearest player and stops a couple of studs short so that it doesn't walk on top of the player. I've tried this:

local pos1 = monster.Position
local pos2 = player.Position
local newPos = (pos1 - pos2).Unit * ((pos1 - pos2).Magnitude - 5)

I was thinking calculating the vector unit which I believe gets the direction of the player position and then multiplying that minus the distance between the two positions minus 5 studs. For some reason this doesn't work, the monster behaves very oddly - moving in random directions and not ever coming close to the player.