How do I make a part constantly offset..?

Im trying to figure out a method on how to keep a part offset constantly relative to different part.

I’ve been trying a few things but nothing really comes close to what i am trying to achieve in the picture.


Shown by this beautiful image.

1 Like

Just to make sure I’m comprehending this correctly, is this what you’re referring to?
image
image

The orange highlight refers to the direction the part is facing.

1 Like

Yup, the part stays in a relative offset regardless of the humanoidrootparts rotation is what Im looking for

Great. The simple solution I came up with was first setting the initial orientation of the part and then just constantly updating the position and adding the offset to that position.

Like so:

local Part1 -- Reference the 1st part
local Part2  -- Reference the 2nd part
local Offset = Vector3.new(2, 0, 0) -- Your offset (X,Y,Z) from the initial orientation

--<< Set the initial orientation (and position) using CFrame >>--
Part1.CFrame = Part2.CFrame

RunService.RenderStepped:Connect(function()
     Part1.Position = Part2.Position + Offset
end)

Here’s a video showcasing the code above (for reference I used an offset of 2, 0, and 5 for the x, y, and z axes respectively:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.