Help with Detecting Brick Collision

I am trying to stop the truck from moving whenever it collides with a part or humanoid. The problem is that the truck goes through the brick wall but stops when it collides with the humanoid.


This is my code so far:

local truck = script.Parent
local drive = true

	if hit:IsA("BasePart") or hit:IsA("Model") or hit.Parent:FindFirstChild("Humanoid") then
		drive = false

while drive do
	truck:SetPrimaryPartCFrame(truck:GetPrimaryPartCFrame() *,0,0-.1))

What should I do to fix this?

The reason for this is because the touch event is rather particular. It requires at least one of the parts to have collision enabled, and it won’t trigger with CFrame or position updates if it’s anchored, unless the other part is unanchored.

However, the touch event doesn’t need to be used. Instead, I would recommend using Region3. Specifically, Rotated Region3 by EgoMoose.