Building system causes parts to phase through other parts

  1. What do you want to achieve? Keep it simple and clear!
    I want my building system to be accurate as possible, but there’s just a problem with it that causes parts to phase through other built parts.

  2. What is the issue? Include screenshots / videos if possible!
    When I put my mouse close to another part, the part phases through it without any collisions.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried searching up methods and even looking through other people’s scripts to find a solution but they were too complicated.

Video of glitch:

Here is my code:

function startplacement(b)
	local clone = b:Clone()
	local mousepos
	clone.Parent = workspace.ObjectPlacing
	clone.CanCollide = false
	clone.Anchored = true
	clone.Transparency = 0.5
	placing = true
	while placing do
		mousepos = mouse.Hit.p
		clone.Position = clone.Position:Lerp(Vector3.new(round(mousepos.x),round(mousepos.y)+clone.Size.Y/2,round(mousepos.z)),0.5)
		rs.RenderStepped:Wait()
	end
	gui.Place:Play()
	clone.CanCollide = true
	clone.Transparency = 0
	clone.Parent = workspace
	clone.Position = Vector3.new(round(mousepos.x),round(mousepos.y)+clone.Size.Y/2,round(mousepos.z))
	local thread = coroutine.create(CreateIcons)
	coroutine.resume(thread,bframe.Options.ScrollingFrame,BOSelected)
	local thread1 = coroutine.create(placefx)
	coroutine.resume(thread1,clone)
	local twn = ts:Create(bframe.Options,ti,{Position = UDim2.new(0.25,0,0,0)})
	local twn1 = ts:Create(bframe.Selection,ti,{Position = UDim2.new(0,0,0,0)})
	local twn2 = ts:Create(bframe.Placing,ti,{Position = UDim2.new(0,0,1.5,0)})
	twn:Play()
	twn1:Play()
	twn2:Play()
	twn2.Completed:Wait()
	bframe.Placing.Visible = false
end

To prevent parts phasing through one another when in Studio you’ll need to enable collisions, you can find the option to do that here:

image

Yeah but this doesnt use forces and also its in play test mode