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

How do I make a brick fall when touched by a specific brick or touched by an explosion?

Asked by 10 years ago

I'm struggling (since I'm not very good at scripting) to make a brick fall when it is hit by an explosion or touched by a specific brick.

I already have the script I need to make the brick become in-anchored when in contact with another brick, but I'm trying to make a script so that if it is hit by an explosion then it will also become in-anchored. Kind of like a 2 way situation, if it is touched by a specific brick then it will fall, or if it is hit by an explosion, before it touches the specific brick, then it will also fall.

local part = script.Parent
part.Touched:connect(function(hit)
    if (hit.Name == "Meteor") then
        part.Anchored = false
    end
end)

1 answer

Log in to vote
0
Answered by
jav2612 180
10 years ago

You're going to need to be able to obtain the Explosion instance to do this.

Explosion = Workspace.Explosion --???

function ExplosionHit(part)
    if part.Name == "The part you want unanchored's name" then -- you can also use just the objectvalue of the part
        part.Anchored = false
    end
end

Explosion.Hit:connect(ExplosionHit)
Ad

Answer this question