Making a script that will make all fallen parts disappear after 5 seconds

Of course I tried this, But the falling parts are making other parts fall, Which are not part of the explosion.
And also, Sometimes it destroys big parts out of buildings, Even when they are not falling, Only moving a little out of the place because of the explosion.
I need a way to find all parts that are falling out of the building…
Maybe is there some kind of an event I can do with BreakJoints()?

I believe :BreakJoints() only breaks joints between two items I think you should rather do a model to put every item to destroy in and then destroy all its child like this:

local children = InsertYourModelHere:GetChildren()
for i = 1, #children do
if children:IsA("Part") then
children:Destroy()
end
end

I hope I could help you,
Felix.

Please do not recreate posts. One is enough. I’ve already told you that you can use the Explosion Hit event in order to do this.


Your other posts:

Link to the Explosion Hit Event API:

1 Like

That’s not the same topic, I realized that making what I want with the explosive is impossible, The explosion doesn’t help at all.

But I need the event, I want this script to be executed only if those parts are falling out of their place.
For exmaple, If there are parts built this way:
Part
Part
Part
Part
Part
All are welded and jointed to eachother, But if the players make the 2 down parts fall, And than the 2 upper parts fall, The middle part will fall too, Even though the explosion didn’t hit it.
What can I do to make the middle part to disappear too?

Are these messages not asking the same thing?

The 2 first are ther same, This one is not, Making the part disappear by the touch of the explosion is impossible, So I’m searching for another way, Maybe with joints

Who told you it was impossible? What’s wrong with the explosion hit event?

Shouldn’t they all fall since they are welded ? I think you can use the .part0 and .part1 properties of WeldConstraints to do that. Nothing is impossible.

Pretty sure explosions destroy joint and weld objects

Try logging all part positions at startup, and then polling to see if it’s been changed. If so, wait a bit, then destroy.

Even easier, listen to :GetPropertyChangedSignal(“CFrame”) for each part

Example: (Written on my phone so I can’t format right)


for i, c in pairs(workspace:GetDescendants()) do
  if c:IsA("BasePart") then
c:GetPropertyChangedSignal("CFrame"):Connect(function()
      wait(7)
      c:Destroy()
    end)
  end
end

1 Like

Because the explosion hit will only destroy the parts that are touched by the explosion, They do destroy joints and weld objects but some parts that are falling making other parts fall too.
I want to make that every part that is not in his original place will disappear…
Maybe, Some kind of an event which detects when the part doesn’t touch another part named “Part”?

What do you mean? When the upper parts fall too, Nothing will hold the middle part…

Oh, so you want parts to be able to knock down other parts while falling?

And also make them disappear…

Where should I put the script with “:GetPropertyChangedSignal(“CFrame”)”? In every part?

No. One script, listening for all parts. I gave an example in my post.

1 Like

So if I’m correct the your problem is that parts that are only jointed to parts that were hit by the explosion are being dropped because they aren’t jointed to anything. Have you considered looking at these functions:

My problems is when parts fall, They make other parts fall, And I don’t know how to detect all of the falling parts

Have you looked at my reply? I explained how to do that, even going as far as to give code.

1 Like