Currently I’m making a furniture placement system where on key pressed a clone of the model is created and follows the mouse position.
However the problem is the model seems to clip into parts pictured below.
I had initially played with the idea of adding the floors y size to the tables CFrame but that only raises the part by one stud, not to mention it wouldn’t work if the floor was very thick.
Local Script
ReplicatedStorage.FurniturePlacement.OnClientEvent:Connect(function(Table)
CreatedFurniture = true
mouse.Move:Connect(function()
if CreatedFurniture then
for i, v in pairs(Table:GetChildren()) do -- Table is the furniture model
if v.Name ~= "GridPart" then -- Gridpart is the primary part
v.Transparency = 0
end
end
SnapFurniture() -- "Snaps" furniture to grid
mouse.TargetFilter = Table
local floor = mouse.Target
Table:SetPrimaryPartCFrame(CFrame.new(Vector3.new(posX, posY, posZ))) -- Pos values from SnapFurniture function
end
end)
end)