Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to Make a vehicle part crash system?

i want the part to brake or fall apart when crashed into with a car

1 answer

✓ Accepted answer

Connect the BasePart.Touched event to BasePart:BreakJoints(), and make sure the part that touches the car is not part of the car.

This script should be put in your car. Any part named Wheel will not fall off.

local car = script.Parent
for _ , part in pairs(car:GetDescendants()) do
    if part:IsA(“BasePart”) and part.Name ~= “Wheel” then
        part.Touched:Connect(function(hit)
            if not hit:IsDescendantOf(car) then
                part:BreakJoints()
            end
        end)
    end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.