Model facing the wrong way


The taps should be against the wall, but no matter I do it’s always the other way. Tried rotating the original model. Move the PrimaryPart to back side of the model (tap side)

local coords = {'X', 'Y', 'Z'}

function getCFrame(mouse, thickness)
	local CF = mouse.Target.CFrame
	local touch = CF:Inverse()*mouse.Hit
	
	local pos = {}

	local normalAxis = mouse.TargetSurface.Value % 3 + 1
	local dir = {0, 0, 0}
	for axis, coord in next, coords do
		if axis == normalAxis then
			local sign = math.sign(touch[coord])
			pos[axis] = touch[coord] + sign*thickness/2
			dir[axis] = sign
		else
			pos[axis] = math.floor(touch[coord] + 0.5)
		end
	end
	pos = Vector3.new(unpack(pos))
	dir = Vector3.new(unpack(dir))
	
	return CF * CFrame.new(pos, pos + dir)
end

itemClone:SetPrimaryPartCFrame((getCFrame(mouse, itemClone.PrimaryPart.Size.Z))*CFrame.Angles(0, 0, var.Rotation))

Setting the PrimaryPart to the side of the taps just does this. The model does not want to rotate around :confused:


1 Like

Try to replace the bottom line to this. Because it looks like you are trying to rotate the entire function which should error, You need to rotate the CFrame.

itemClone:SetPrimaryPartCFrame((getCFrame(mouse, itemClone.PrimaryPart.Size.Z)*CFrame.Angles(0, 0, var.Rotation)))

It never errored out before. Pasting your edit however did nothing. Model still does exactly what’s pictured above :confused: