So I have this extremely simple part (and model) placing script thats skeleton looks something like this...
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local model = game.ServerStorage.Model
local build = false
function startBuilding()
build = true
local obj = model:Clone()
while build do
wait()
model:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.) * whatever_rotation_angle)
end
end
mouse.Button1Down:Connect(function()
if not building then
startBuilding()
else
building = false
end
end)
Very simple, but the issue with it is that when the mouse.Target has an object in it, the mouse.Hit.p gets a bit skewed and ends up placing the model a bit higher up and inside of the mouse's target.
The desired behavior I want is for when mouse.Target has an Instance, then snap to the mouse.TargetSurface regardless of the rotation of the model.
How would I offset the model so that it sort of snaps to the face of the mouse's target?
Edit: I was able to get the height to snap in this example, but I still don't know how to snap the X and Z according to the side face.

5 comments
CanColide makes the object unable to go through each other and Anchored makes it stay still (you should know already). Without Anchored and CanColide, it will (might) go through each other and maybe get fling around the map.
CanCollide doesn't matter with CFrames, and if I used Position then it would appear on top of the mouse.Target.
There's also a property of a BasePart called Surface (I forgot) which IDK what it does.
The mouse.TargetSurface (like I mentioned in my post) returns values 0-5 (surfaces), but you can't use them for position. The part surfaces are just strings, so you can't use those either.
Or you could manually face snap it yourself (but it wouldn't look so great). Other than that, I do not know any other ways.