So I’ve got this script here, works fine, but the sounds flips out when I run it. It just starts to play it multiple times and it sounds glitchy and does not even finish the sound. Would you debounce just the sound? Or would that not fix it?
game.Workspace.Part.GlassShatter.Enabled = false
local Part = script.Parent
local sound = Instance.new("Sound", game.Workspace.Part)
sound.SoundId = "rbxassetid://5183344180"
Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
sound:Play()
wait()
sound:stop()
Part.Transparency = 1
Part.CanCollide = false
wait()
Part.GlassShatter.Enabled = true
Part.GlassShatter.Rate = 100
Part.GlassShatter.Life = NumberRange.new(1,1) --stack ends here
wait()
print("Ran")
Part.GlassShatter.Enabled = false
end
end)
This and just use the GlassShater.Stop value as well to make sure if you want.
If you feeling picky use the developer.roblox help page to find more values if that doesn’t help.
I’m also not understanding why you are using “Enabled” for a sound value, when clicking on audio the values are stated there.
You need to make the debounce wait more than task.wait()
The reason for a wait in a debounce is exactly for reasons like multiple hits in a touched function.