Roblox Sound Effects Heard by you, but not by Opponents
April 28th, 2023So I created a Roblox game. I added a gun. The gun works quite well. It shoots people and kills them just like a gun should do. When I shoot my gun, I hear it just fine. But when others shoot me in the game, I don't hear them. My guns sounds don't appear to be travelling through the network.
Googling this solution lead me to:
- https://create.roblox.com/docs/reference/engine/classes/Sound#RollOffMaxDistance
- https://create.roblox.com/docs/reference/engine/classes/Sound#RollOffMinDistance and
- https://create.roblox.com/docs/reference/engine/classes/Sound#RollOffMode
Apparently you want the RollOffMaxDistance high, RollOffMinDistance pretty low and RollOffMode should be fine as "Inverse".
The very first thing I see in the Sound Documentation is "A sound placed in a BasePart or an Attachment". Hmm, the class I am seeing is "UnionOperation". Perhaps this is why it is not working.
Nope. I went down several paths. I made a gun from scratch. What I noticed is that when I put the gun in the game and I went and picked up the gun, the sounds worked fine. But when I clone the gun and equip the player with it, gun sounds were not fine.
First thing you want to check is that the gun is setup to play sounds from the server side. If they just play on the client, then you can expect to only hear them on the client. Once you have the sounds playing from the server side, you have to equip the player from another server side script. If you equip the player from a client script, it doesn't have permission to or ability to run server code.
To summarize, ensuring that the sound is being played through a "Script" and the player is being equipped through a "Script" instead of "ClientScript" was what fixed this for me.
Posted In:
ABOUT THE AUTHOR:Software Developer always striving to be better. Learn from others' mistakes, learn by doing, fail fast, maximize productivity, and really think hard about good defaults. Computer developers have the power to add an entire infinite dimension with a single Int (or maybe BigInt). The least we can do with that power is be creative.