How to slightly shift character back from this ray?

I’m working on an M1 combat system that uses rays to detect objects in front of the player to calculate the distance the player needs to move in order to not go through the wall or fling themselves. Everything is going well, but I was wondering how I could implement more space between the player and the object if an object is detected while the ray is casted. I will provide pictures to further support this question.

SCRIPT:

local MAX_DISTANCE = 7
local ray = Ray.new(HumanoidRootPart.Position, HumanoidRootPart.CFrame.LookVector * MAX_DISTANCE)
local part, position = workspace:FindPartOnRay(ray, HumanoidRootPart.Parent) 
MakeRayVisible(ray)
local BodyPosition = Instance.new("BodyPosition", HumanoidRootPart)
BodyPosition.Name = "Client"
BodyPosition.D = 500
BodyPosition.MaxForce = Vector3.new(10000, 10000, 10000)
BodyPosition.P = 3000
BodyPosition.Position = position

Here are some pictures of what I need done:

Current situation:
https://gyazo.com/ecc49d63031ef4e7dc0a8d9f747831ec
https://gyazo.com/671a81f741e24bc566a3fda76e7caeb9

What I want:
https://gyazo.com/ef635dc8134e41e56455530e58f0feea

Check if this works, it must!

local rp = HumanoidRootPart.Position
local ray = Ray.new(HumanoidRootPart.Position, HumanoidRootPart.CFrame.LookVector * MAX_DISTANCE)
local part, position = workspace:FindPartOnRay(ray, HumanoidRootPart.Parent) 
MakeRayVisible(ray)
local BodyPosition = Instance.new("BodyPosition", HumanoidRootPart)
position = position + (position - rp).Unit 
BodyPosition.Name = "Client"
BodyPosition.D = 500
BodyPosition.MaxForce = Vector3.new(10000, 10000, 10000)
BodyPosition.P = 3000
BodyPosition.Position = position

I tried but,

position = position + (position - HumanoidRootPart).Unit 

gives an error.

Oops, sorry, that line does NOT give an error. However, the character goes through walls now when setting body position to lunge forward.

Found solution after some experimentation