Problem with objects clipping through walls

So basically ive been making a placement system for my roblox game. Sometimes the objects clip through each other which isnt a big of a problem until the player rejoins the game. I made their buildings save but when they load the objects stack on eachother. This is because they are too close to each other. Does anyone have a solution for the placement system to prevent items from clipping when the player is placing the selected item?

1 Like

I encountered a similar problem, though with a dragging system rather than a placement system. This helped me solve my problem.

2 Likes

wait so this my code:

										local objectangles = CFrame.Angles(0, math.rad(rotationamount), 0)
										previewobject:SetPrimaryPartCFrame(objectcframe*objectangles)

I added runservice but how do I implement that code to this?

I just tried that code and for some reason the object doesnt move. No error show too

								if placingobject == true then
									mouse.TargetFilter = previewobject
									if previewobject:FindFirstChild("MainPart") then
										local ignoreList = {game.Players.LocalPlayer.Character}
										if previewobject ~= nil then
											table.insert(ignoreList,previewobject)
										end
										local mouseRay = mouse.UnitRay
										local newRay = Ray.new(mouseRay.Origin, mouseRay.Direction.Unit * 35)
										target, pos, norm = workspace:FindPartOnRayWithIgnoreList(newRay, ignoreList)
									end
								else
									previewobject:Destroy()
								end
								if placingobject == false then
									script.Parent.Inventorybtn.Visible = true
									script.Parent.Rotation.Visible = false
								end
							end)```