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:
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.
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()
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.
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)
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.
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.
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.
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…