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 11 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.

1local part = script.Parent
2part.Touched:connect(function(hit)
3    if (hit.Name == "Meteor") then
4        part.Anchored = false
5    end
6end)

1 answer

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

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

1Explosion = Workspace.Explosion --???
2 
3function ExplosionHit(part)
4    if part.Name == "The part you want unanchored's name" then -- you can also use just the objectvalue of the part
5        part.Anchored = false
6    end
7end
8 
9Explosion.Hit:connect(ExplosionHit)
Ad

Answer this question