You can write your topic however you want, but you need to answer these questions:
What do you want to achieve?
I want my clientStructure model to offset so it is flat against the face my ray is hitting. I want it to also work with 90 degree rotations.
What is the issue?
It works like intended when i dont rotate my clientStructure.
Example image:
What solutions have you tried so far?
I have looked around at this devforum and tried some solutions which didnt work. I have also tried asking ChatGPT with no succes (it ususally helps) and i have tried changing up some CFrames in the script, but i just wont understand how they work.
Here is the part of my script:
local newAnglesCFrame = CFrame.Angles(0, math.rad(yOrientationSnapped), 0)
local newCFrame = CFrame.new(math.round(position.X), position.Y, math.round(position.Z))
local offsetCFrame = CFrame.new(normal * clientStructure.Hitbox.Size * 0.5)
offsetCFrame *= newAnglesCFrame
newCFrame *= offsetCFrame
clientStructure:SetPrimaryPartCFrame(newCFrame)
Thanks for letting me know about this, but i would prefer to use something that doesnt require modules. I am going to try this if i cant figure out what to do.