Trying to play a sound from a serverscript inside a tool not working

Okay so basically i got a gun and the problem is that when i shoot, everyone can hear it from anywhere on the map, so i tried to make a serverscript which is inside a tool:

script.Parent.Activated:Connect(function()
	script.Parent.Fire.Gun_Shot2:Play()
end)

i literally get 0 errors, 0 warnings, 0 anything, the sound just doesn’t play

2 Likes

How does your tool look like? If your tool does not have a Handle part, but the Tool.RequiresHandle is on, then Tool.Activated event will not fire.

So, if your tool does not require a Handle part, turn Tool.RequiresHandle off, otherwise keep it on and make sure a part called Handle is a child of the Tool.

it has a handle and has “RequiresHandle” on

but its still not playing any sounds from the gun

Can I see how your tool looks like? Show me the tool’s hierachy in the Explorer tab and the Tool’s properties.


(the Fire part contains the sound)

Have you made suree the script is running? Try putting a print statement before connecting the event to ensure that the script is running.

yeah, it runs, it prints out my statement

Now try to see if the event responds by putting the print statement inside the function of the event. It should print the statement every time you hold and click the tool if Activated event is connected properly.

wait, i think the problem might be that i don’t check if its equipped

If the tool is not equipped, then the event will not run. Make sure you are equipping the tool.

nevermind, it still doesn’t play the sound

Can you please check this first? We need to make sure if the event is connected in order to find the root cause of the problem.

Show a screenshot of your Gun_Shot2 Properties.
I think you may have the RollOffMaxDistance probably at the default # of 10,000. This means that everyone within 10,000 studs of the gun hears the sound. Try something like Minimum of 20 and Maximum of 100 for starters.

Personally I like the RollOffMode to be set to InverseTapered as well. Inverse just cuts off at the limit. but using InverseTapered means the sound gets quieter until it disappears at the RollOffMaxDistance.