Basically, I have this gray aiming part that is looking at the red brick, however the part must ALWAYS stay behind the transparent wall, no matter the size of the transparent wall too, I basically always want the part to be behind the transparent wall, while facing the red brick.
here’s what I got so far.
local target = workspace.Target
local lookatpart = workspace.AimPart
local hidebehind = workspace.HideBehindWall
lookatpart.CFrame = CFrame.lookAt(lookatpart.Position, target.Position)
lookatpart.CFrame = lookatpart.CFrame:ToWorldSpace(CFrame.new(0, 0, hidebehind.Size.Z / 2 + lookatpart.Size.Z / 2))
on the Z axis it works perfectly fine, even with size changes from the transparent wall.
however, by changing the size of the transparent wall on the X axis, the gray aiming part’s position no longer is behind the transparent wall.
however on the X axis, it seems to be off.
if anybody can provide any help, all would be appreciated. i’ve been stuck on this for a while now.