So I made this little button GUI that will grow and shrink a bit when clicked on, as well as make a sound. While the former works, it only makes the sound like 80 percent of the time... is there some hidden rule about sounds that I don't know about?
local debounce = false local p = script.Parent.Parent function anim() if p.Position.Y.Scale >= .75 and script.Parent.Parent.Parent.Parent.Clicked.Value == true then p:TweenSizeAndPosition(UDim2.new(.32, 0, .17, 0), UDim2.new(.49, 0, .74, 0), 'Out', 'Linear', .05) --Making the button slightly bigger when clicked end local sound = p.Parent.Parent.Parent.Parent.Sound.Button.Button1 --I have a template sound stored so that I can edit it as I wish local newSound = sound:Clone() newSound.Parent = script.Parent newSound.Volume = sound.Parent.Value * sound.Volume newSound:Play() wait(.05) if p.Position.Y.Scale <= .75 and script.Parent.Parent.Parent.Parent.Clicked.Value == true then p:TweenSizeAndPosition(UDim2.new(.3, 0, .15, 0), UDim2.new(.5, 0, .75, 0), 'Out', 'Linear', .05) --Shrinking it back down .05 sec later end repeat wait() until newSound.IsPlaying == false newSound:Destroy() --Destroy the sound when it's finished playing end script.Parent.MouseButton1Up:connect(function() if debounce == false then debounce = true anim() --Firing the above function script.Parent.Parent.Parent.Parent.Click.Value = 1 end repeat wait() until script.Parent.Parent.Parent.Parent.Click.Value == 0 debounce = false end)
The only thing that I can see here that may be causing your problem is the newSound.Volume = sound.Parent.Value * sound.Volume
Sometimes when the volume gets too loud some speakers won't play it because it's out of the range of what the speaker can physically play.
Also it could be that for whatever value it is being multiplied by, it is equalling to a number greater than 10 which is the max volume a sound can be.