I’m making a simple hovering script using raycasting, but I don’t know how to rotate the part 90 degrees like this. The part has an attachment that it puts at the raycasts position and normal. The part is teleported to the attachment’s lookvector * 5, but for some reason it’s rotated 90 degrees. The part is supposed to be parallel to the baseplate.
Why are you using an attachment? Especially inside the part. When changing the CFrame of the part the attachment will move along with it, is this your intended behavior?
I would just make a variable to store the variable, thus making a non-physical point which you can alter and use:
local point = CFrame.new(pos, pos+norm)
part.CFrame = point.CFrame + point.CFrame.LookVector * 5