How can I create a part that makes a sound when ever it touches another part?

How can i make a part that would make a sound when ever another part touches it cause i would really like to know how to make this

local Part = script.Parent --Part location(assuming the script is inside it)
local Sound = Part.Sound --Sound location 

local DTime = 0.08 --debounce time, used to avoid spam playing the sound
local Debounce = false 
Part.Touched:Connect(function(hit)
	if Debounce then return end --ignore the touch, the debounce is active 
	Debounce = true 
	Sound:Play() 
	task.wait(DTime) 
	Debounce = false 
end)
1 Like