Help on glass breaking script

Hello everybody

Quick note I have pretty much zero scripting knowledge, so I might not understand some responses. I have been making a game where you basically are on 1 of 4 teams, and fight to control a small town. Anyways, there are lots of houses, and I want to be able to make the glass break. Would it be possible to make any part that is the material Glass break (disappear) when it is shot, and then regenerate after a certain time? Or would I have to put the script in each part individually? The reason I am wondering this is because there are a lot of windows, and it would take forever. If it changes anything the game uses the ACS gun system.

Yes, that would be fairly easy to make by scouring through every descendant in workspace and checking if it has the material of glass (or just using CollectionService).

For the glass breaking, you should probably use a glass fracturing module like this one: FragmentSmasher - Window/other object obliterator Module

let me tell you a way you can do this easily.

what you need to do is put a ClickDetector inside the glass block

then put a script inside of the block

after that you could do something like

script.Parent.MouseClick:Connect(function()
	script.Parent.Parent.Transparency = 1
         wait(20)
script.Parent.Parent.Transparency = 0
end)

the thing is I dont want the player to click the glass I want them to shoot it with the gun. if you are saying that the click detector would work while using the tool I have already tried and it doesnt.

To be clear I would want to glass to just disappear, so transparent and can collide off, not shatter

If your script uses raycast, aka an invisible laser/laser bullet, you can use the result where the raycast intersects to change the transparency and CanCollide property. If it uses physical bullets, you can have the bullet’s touch event return whatever part it touches, and you can change the transparency and CanCollide property from there. In the same function, you can have the part wait for some seconds before changing the transparency property to visible and CanCollide. I do highly recommend getting at least the foundational knowledge of script to truly understand what most of us may give for the answer.