Sound being "glitchy"

For some reason, playing Sound through Soundinstance:Play() (while the Sound’s parent is a Part) makes one sound very glitchy and discontinuously.

Sounds perfectly fine if you will destroy that Sound (if it’s being played through giving it PlayOnRemove and destroying it).
No SoundService settings are changed, and the Sound plays normally if not in Part. There isn’t a problem with a sound card, as other players have this issue in my place too, both in Studio and Client.

Here’s an example, where first Sound is played normal way, and the second is played trough PlayOnRemove:

3 Likes

See if it acts the same way after you publish. I’ve noticed some sounds seem off in the Studio.

2 Likes

can you show the code that plays it? this sounds like multiple of the same sound are being overlapped

1 Like

Already told that it acts the same in both Studio and Client.

1 Like

Update: It seems like they are so glitchy if they are being played on server. I’ll try to make so they get replicated to client instead to see if it will work.

nope, did not help

1 Like
game.ReplicatedStorage.Remotes.StatChangers.PlaySound.OnClientEvent:Connect(function(Playerie: Instance, SoundItself: Sound, KillIt: boolean, Volumee, PlaybackSpeed, Location, DestroyAfter)
	local Sound = SoundItself:Clone()
	if not Location then 
		Sound.Parent = Playerie:FindFirstChild("HumanoidRootPart") or Playerie.PrimaryPart
	else
		Sound.Parent = (Location:IsA("Model") and Location.PrimaryPart) or Location
	end
	if Volumee then Sound.Volume = Volumee end
	if PlaybackSpeed then Sound.PlaybackSpeed = PlaybackSpeed end
	Sound:Play()
	if DestroyAfter then 
		game.Debris:AddItem(Sound, DestroyAfter)
	end
	Sound.Ended:Connect(function()
		Sound:Destroy()
	end)
end)

The sound is being glitchy even if it’s being played by simple Sound:Play()

1 Like

can you show the code that fires the PlaySound remote when you eat the cheeseburger?

1 Like

What volume and playback speed are you sending to the client? It appears to me that your audio appears much louder and glitchy due to the different volume and playback speed.

1 Like

None. If a script does not detect volume and playbackspeed, it uses Sound’s, which work normal when not played with Sound:Play()

1 Like

Maybe try parenting your sound to the workspace, and see if that changes the effect of the sound.

2 Likes

Cheezburger’s script part:

RemotesFolder.StatChangers.Sound:Fire(Character, SoundList["CanIHas"], true) -- RemotesFolder is a folder in ReplicatedStorage with remotes, Character is a player's character, SoundList["CanIHas"] is a sound itself

Receiver script part:

RemotesFolder.StatChangers.Sound.Event:Connect(function(Playerie: Instance, SoundItself: Sound, KillIt: boolean, Volumee, PlaybackSpeed, Location, DestroyAfter)
if SoundItself and not KillIt then RemotesFolder.StatChangers.PlaySound:FireAllClients(Playerie, SoundItself, KillIt, Volumee, PlaybackSpeed, Location, DestroyAfter)
		--[[elseif SoundItself then
			local Soundd = SoundItself:Clone()
			if not Location then 
				Soundd.Parent = Playerie:FindFirstChild("HumanoidRootPart") or Playerie.PrimaryPart
			else
				Soundd.Parent = (Location:IsA("Model") and Location.PrimaryPart) or Location
			end
			if Volumee then Soundd.Volume = Volumee end
			if PlaybackSpeed then Soundd.PlaybackSpeed = PlaybackSpeed end
			Soundd:Destroy()--]] -- All of this part doesnt matter in this case
		end
end)
1 Like

It works, but how do I make so it has a source? Otherwise all players can hear it, independent of distance.

1 Like

Another thing you can try is rather than firing the sound object to the client, you can instead fire the sound id, and then create a new sound on the client side with that sound id.

I also recommend experimenting with the roll off mode, as that impacts how the audio sounds.

1 Like

None of these have worked, sadly.

1 Like

Have you tried creating a new sound using Instance.new() on the client side? That way only the player can hear the audio and no other players can. Unless you want all players to hear the audio if they are within a specific range.

edit:

I assume that parenting the sound to the humanoid root part is causing your weird audio issues, which is why I recommended parenting the sound to the workspace, but there is a hacky way to parent audio to the character. You could create a massless invisible part at the character’s position and parent the sound there. That might fix the problems you are having.

2 Likes

I need so all players in certain range that starts from certain object will hear audio. (and without those audio issues, of course)

1 Like

Okay, if you want to have all players hear the played audio within a certain range, I recommend creating a new anchored invisible part in the humanoid root part. You can create a new sound instance or clone your sound within that part. This is obviously not the best method, but it should remove the weird audio glitch and other players should be able to hear the sound when in range of the character.

Here’s a snippet of what you could do:

local part = Instance.new("Part")
part.Anchored = true
part.Transparency = 1
part.CanCollide = false
part.Parent = path.to.HumanoidRootPart.Position

yourClonedSound.Parent = part
1 Like

Yeah, this seems to work. Much gratitude.
I really wish I was doing actual game development instead of making crutches to compensate poor coding I can’t edit…

image

1 Like