local t=script.Parent local F=30 for t,A in ipairs(t:GetDescendants())do if A:IsA("\066\097\115\101\080\097\114\116")then A.Touched:Connect(function(t)local W=A.Velocity.Magnitude local Q=GetImpactVelocity(A,t)local I=t.Parent:findFirstChild("\072\117\109\097\110\111\105\100")or t.Parent.Parent:findFirstChild("\072\117\109\097\110\111\105\100")if Q>F and I==nil then A:BreakJoints()A.Massless=true A.CanTouch=false;(game:GetService("\068\101\098\114\105\115")):AddItem(A,10)end end)end end function GetImpactVelocity(t,F)local A=t.Velocity local W=F.Velocity local Q=Vector3.new(math.floor(A.X),math.floor(A.Y),math.floor(A.Z))local I=Vector3.new(math.floor(W.X),math.floor(W.Y),math.floor(W.Z))local h=Vector3.new(Q.X-I.X,Q.Y-I.Y,Q.Z-I.Z)h=Vector3.new(math.abs(h.X),math.abs(h.Y),math.abs(h.Z))local g=math.max(h.X,h.Y,h.Z)return g end

local Body = script.Parent
local BreakSpeed = 30

for _,Part in ipairs(Body:GetDescendants()) do
	if Part:IsA("BasePart") then
		Part.Touched:Connect(function(hit)
			local velocity = Part.Velocity.Magnitude -- Get the speed of the car
			local collisionforce = GetImpactVelocity(Part,hit)
			local h = hit.Parent:findFirstChild("Humanoid") or hit.Parent.Parent:findFirstChild("Humanoid")
			if collisionforce > BreakSpeed and h == nil then
				Part:BreakJoints()
				Part.Massless = true
				Part.CanTouch = false
				-- you can make so that a sound plays, or an effect appears etc...
				game:GetService("Debris"):AddItem(Part,10)
			end
		end)
	end
end

function GetImpactVelocity(part, Other)
	--dont touch this
	local pVelocity = part.Velocity
	local oVelocity = Other.Velocity

	local pRoundedVelocity = Vector3.new(math.floor(pVelocity.X), math.floor(pVelocity.Y), math.floor(pVelocity.Z))
	local oRoundedVelocity = Vector3.new(math.floor(oVelocity.X), math.floor(oVelocity.Y), math.floor(oVelocity.Z))

	local impactForce = Vector3.new(pRoundedVelocity.X - oRoundedVelocity.X, pRoundedVelocity.Y - oRoundedVelocity.Y, pRoundedVelocity.Z - oRoundedVelocity.Z)
	impactForce = Vector3.new(math.abs(impactForce.X), math.abs(impactForce.Y), math.abs(impactForce.Z))

	local speed = math.max(impactForce.X, impactForce.Y, impactForce.Z)

	return speed
end
