I’m looking to make sounds happen when unanchored parts fall, but I don’t really know how to do it. I don’t really know anything about roblox studio physics. So I’m asking here.
For example: someone picks up a soda can and throws it across the room. you will be able to hear the can hitting the floor/wall.
You could try adding a script which will listen for the .Touched event (according to this, .Touched relies on physics like you wanted to) on the can, and each time this event fires, you play a sound. If you want the sound to come from the collision point, then just make sure that the parent of the sound is the can, and normally when the script plays the sound, the noise will come from the can (almost the collision point, but precise enough).
To further upgrade this, you could add your own tags to parts that should make different sounds.
For example, you have a metal part, maybe the can will make a different noise when colliding with it, so you manually add a tag to the metal part like “Metal”, and in the script, you just add conditions on the touched item like this :
local CollectionService = game:GetService("CollectionService") -- Tags manager
[your_can].Touched:Connect(function(touched_part)
if CollectionService:HasTag(touched_part, "Metal") then -- When can touches a metal part, can play a metallic sound for example
-- play the metallic sound
elseif ... then
...
end
end)
Could you try this and tell me if this resolves your problem ?
@1_Lukeskyiwalker’s approach is good. You should also account for the velocity of a given part to make sure the volume and timbre of the sound make sense for the force of each collision (an easy way to do this is to get the Magnitude of the object’s AssemblyLinearVelocity). Also, it would probably be smart to assign multiple unique sounds to each category of sound to prevent repetition (for example, the soda can could play a collision noise from any “metal hit” sound in a soundbank).
If you are going to use Touched, add a debounce; otherwise, the sound will be spammed and result in inaccurate behavior.