How do I position a Part right next to another Part at the side it came from using a script?
I think the image explains it a bit better
I have no idea but I have tried some simple code halfing the Size of the TargePart and testing raycast but the size math relative to the position is the problem
Hey I believe I found the answer,
It needs some adjustments and it dosent include any orientation math but but here it is:
local otherPart = script.Parent.Part2
local part = script.Parent.Part1
-- Determine which side the part came from
local side = (part.Position - otherPart.position).Unit
-- Calculate the new position of the part
local newPosition = otherPart.position + side * (otherPart.Size / 2 + part.Size / 2)
-- Set the position of the part
part.CFrame = CFrame.new(newPosition)