Error with my addon

So I got this error


[ERROR] addons/arrestmusic/lua/autorun/arrestmusic.lua:14: '<name>' expected near '"sound/badboys.mp3"'
  1. unknown - addons/arrestmusic/lua/autorun/arrestmusic.lua:0

This is line 14


	net.Receive("arrestedSound", function( len )

I’ve tried to fix it but I dont know how

You have made a syntax error in your code.

We will need to see more code to help you.


 if SERVER then
	util.AddNetworkString( "arrestedSound" )

	local badboysSound = "sound/badboys.mp3"
	resource.AddFile( badboysSound )

	hook.Add( "playerArrested", "PlaySoundForArrested", function( crim, time, arrs )
		net.Start( "arrestedSound" )
			net.WriteString( badboysSound )
		net.Send( crim )
	end )

elseif CLIENT then
	net.Receive( "arrestedSound", function( len )
		local badboysSound = net.ReadString()
		if not badboysSound then return end
		
		surface.PlaySound( badboysSound )
	end )
end

Provided code does not cause provided error.

You really shouldn’t have to network the sound string – just ping the client with no net data to play that sound since it’s a constant string.

Apperently the error was that i should only have it as “badboys.mp3” not sound\badboys.mp3

Also how can I make it so the music stops once the player is unarrested?