How to keep a fixed distance between a two parts, a stationary one, and one that orbits the other when using .Unit?

This is a bit hard to explain but basically I’m trying to keep a fixed distance between two a center part, and another part orbiting it, so like a constant 5 block distance between each of the parts. Sorry if this explanation isn’t clear, here is a video and the script:

local rootpart = script.Parent:WaitForChild("HumanoidRootPart")
local workspacepart = workspace.part
local part = Instance.new("Part", workspace)
part.Size = Vector3.new(1, 1, 1)
part.Anchored = true
part.CanCollide = false
part.Shape = "Ball"
part.Material = "SmoothPlastic"

game:GetService("RunService").Heartbeat:Connect(function()
	part.Position = Vector3.new(-(rootpart.Position - workspacepart.Position).unit.X*5, workspacepart.Position.Y, -(rootpart.Position - workspace.part.Position).unit.Z*5)
end)

As you can see in the video, the outside part gets closer to the center part as I move near it, and gets further away from the center part as I move away from it. Also, here’s a copy of the place if you want to see it for yourself:

Test.rbxl (20.9 KB)

Thanks for your time!

idk if this is what you are looking for

local offset = 5;
game:GetService("RunService").Heartbeat:Connect(function()
    part.CFrame = CFrame.new(workspacepart.Position, rootpart.Position) * CFrame.new(0,0,offset);
end)
1 Like

This was exactly what I was looking for, I guess I didn’t need to use .unit at all. Thanks!