Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to un-anchor a part using script?

Asked by
14dark14 167
4 years ago

I want to make a bulldozer that can destroy buildings. and I wanted to make a script that would be inside a part that's in front of the vehicle.

script.Parent.Touched:Connect(function(hit)

        hit.Anchored = false
end)

but when any brick hits the part it doesn't get unacnored

1 answer

Log in to vote
1
Answered by
Ghost40Z 118
4 years ago

First of all, you want to rename all the bricks you want un-anchored to the same name.

script.Parent.Touched:Connect(function(hit) --touch function
    if hit.Name == "BuildingBrick" and hit:IsA("Part") then --Checks if the touched object is a part called "BuildingBrick"
        hit.Anchored = false --sets the anchored to false
    end
end)
0
Thanks 14dark14 167 — 4y
0
No problem. Ghost40Z 118 — 4y
Ad

Answer this question