Need help tracking amount of bricks exploded

Been tryna figure out a way to track how many bricks have been exploded when a player shoots a rocket at lets say a small box made of 15 bricks. How would i exactly track that so i know if it blows up 3 or 10 bricks? Spent too much time trying on my own so help is greatly appreciated!

1 Like

Assuming you are using an explosion object you can use this event

https://developer.roblox.com/en-us/api-reference/event/Explosion/Hit

1 Like

I get the explosion.hit. Just confused on how id implement that into tracking the number of bricks. I can figure out how to get it to show up in a gui. Just not sure how i get that initial number of brick exploded.

1 Like
local Explosion = Instance.new("Explosion", workspace)
local HitParts = {}

Explosion.Hit:Connect(function(Hit)
	table.insert(HitParts, Hit)
	print(tostring(#HitParts).." have been hit!")
end)


2 Likes

Thank you. Just tested and it does exactly what i needed. counts the bricks that are exploded. I mean it tells me in 20 lines but Thank you lol. Now i just gotta implement into a leaderboard and gui. Greatly appreciated