I'm thinking of making a script that can recreate the old 2012 "brick clatter" noises. I think the script would have to check all moving bricks and check if they have hit another part or not.
I know how to check if two or more parts are colliding, however, creating a variable for every single part in the whole game and a function to check if any part is hitting any other part is insane and would take a very long time.
any help? :)
If by "brick clatter" you mean when a part touches something it makes a noise, then yea we have to create a touched event for each part.
First we need to get a list of parts to create an event on. We can either do this by setting up a model before hand with all of our parts (recommend) or if its to all parts in the game, which would be laggy depending on the situation, you could use GetDescendants of workspace but i dont recommend it.
So lets say we have a model before hand
local model=workspace.model --model of parts to make touched event --set sound variable and set it to run when destroyed for convenience local sound=script.Sound sound.PlayOnRemove=true --run through all descendants of this model for _,part in pairs(model:GetDescendants()) do --check if part is a part if part:IsA("BasePart") then --create touched event part.Touched:Connect(function() --parent and destroy sound(which will play it since playonremove is on) local s=sound:Clone() s.Parent=part s:Destroy() end end end
And tada! If you have any questions please ask.