I'm trying to figure out how to make a sound play when a certain part is touched. I tried before but it never played.Can someone please type in a script for me?
Assuming you have a part named Button in workspace, and a valid sound named Sound in workspace, this should work:
local debounce = false game.Workspace.Button.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and debounce == false then debounce = true game.Workspace.Sound:Play() wait(1.5) debounce = false end end)
You need: A Sound in Workspace (Call it aSound) a script in the part.
debounce = true script.Parent.Touched:connect(function () if debounce == true then debounce = false workspace.aSound:Play() debounce = true end end)