Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make sound play in a part when the object is hitting or bouncing on something?

Hello, Just wondering how to make a sound plays inside a part, when the part for itself is hitting or bouncing on the ground, walls, other parts ... For example: When I throw a bottle inside a game, I want the soundFX inside it play when the bottle hit something (Table, Wall, Ground...) Basically when hit everything. How to do that? Thanks for help, please I need it as soon as possible.

1 answer

✓ Accepted answer

Just for your information, this is not a demand site - don't just ask for stuff to be made. Please consider this next time. But I'll help you:

Place a script inside the bottle or whatever object you want the sound to play.

local object = script.Parent --you can edit this to wherever you object is located

s.Touched:connect(function(hit)
	if hit.Name == "Part" then --if whatever the object hits is named Part 
		local sound = Instance.new("Sound") --creates a new sound object
		sound.Parent = object --sound will be in the object
		sound.SoundId = 0 --put your soundId here
		sound.MaxDistance = 10 --put your MaxDistance here
end)

Please accept this as an answer if you found this helpful.

This discussion is preserved as it was. New answers, comments, and votes are closed.