I made this script to detect if a part of the character is touched by a weld then destroy the weld. I added sounds to this script. When i touch an object with a weld it just sounds like: BRRRRRGWABBRRRRRRRGWABBBBBBRRRRRGWA. I tried adding a debouce and a wait also and if statement to detect if one of the sounds is playing. (it just made it sound even worse. Heres my code:
script.Parent.RightHand.Touched:Connect(function(part)
local weld = part:FindFirstChild("Weld")
local num = math.random(1,4)
local debounce = false
wait(0.5)
if weld then
if debounce == false then
debounce = true
if num == 1 then
script.Parent["Wood Breaking"]:Play()
end
if num == 2 then
script.Parent["Lego Break Sound Effect"]:Play()
end
if num == 3 then
script.Parent.glass_largesheet_break3:Play()
end
if num == 4 then
script.Parent.metal_break:Play()
end
weld:Destroy()
end
debounce = false
wait(0.1)
end
end)
script.Parent.LeftHand.Touched:Connect(function(part)
local weld = part:FindFirstChild("Weld")
local num = math.random(1,4)
local debounce = false
wait(0.5)
if weld then
if debounce == false then
debounce = true
if num == 1 then
script.Parent["Wood Breaking"]:Play()
end
if num == 2 then
script.Parent["Lego Break Sound Effect"]:Play()
end
if num == 3 then
script.Parent.glass_largesheet_break3:Play()
end
if num == 4 then
script.Parent.metal_break:Play()
end
weld:Destroy()
debounce = false
end
wait(0.1)
end
end)
script.Parent.LeftFoot.Touched:Connect(function(part)
local weld = part:FindFirstChild("Weld")
local num = math.random(1,4)
local debounce = false
wait(0.5)
if weld then
if debounce == false then
if num == 1 then
script.Parent["Wood Breaking"]:Play()
end
if num == 2 then
script.Parent["Lego Break Sound Effect"]:Play()
end
if num == 3 then
script.Parent.glass_largesheet_break3:Play()
end
if num == 4 then
script.Parent.metal_break:Play()
end
weld:Destroy()
debounce = true
end
wait(0.1)
end
end)
script.Parent.RightFoot.Touched:Connect(function(part)
local weld = part:FindFirstChild("Weld")
local num = math.random(1,4)
local debounce = false
wait(0.5)
if weld then
if debounce == false then
debounce = true
if num == 1 then
script.Parent["Wood Breaking"]:Play()
end
if num == 2 then
script.Parent["Lego Break Sound Effect"]:Play()
end
if num == 3 then
script.Parent.glass_largesheet_break3:Play()
end
if num == 4 then
script.Parent.metal_break:Play()
end
weld:Destroy()
debounce = false
end
wait(0.1)
end
end)