Help

The Errors

[ERROR] addons/chainsaw_gunv2.5/lua/weapons/chainsaw_gun/shared.lua:34: bad argument #1 to ‘pairs’ (table expected, got nil)

  1. pairs - [C]:-1
  2. unknown - addons/chainsaw_gunv2.5/lua/weapons/chainsaw_gun/shared.lua:34
  3. Give - [C]:-1
  4. unknown - gamemodes/sandbox/gamemode/commands.lua:708
  5. unknown - lua/includes/modules/concommand.lua:69

[ERROR] addons/chainsaw_gunv2.5/lua/weapons/chainsaw_gun/shared.lua:34: bad argument #1 to ‘pairs’ (table expected, got nil)

  1. pairs - [C]:-1

And the line 34


for k, v in pairs( Sounds ) do

Where are you defining Sounds?

What do you mean? In the script?

Yes. Sounds = what?


function SWEP:Initialize()
	for k, v in pairs( Sounds ) do
		util.PrecacheSound( "weapons/lancer/saw_"..v..".wav" )
	end
end


That?

[editline]24th May 2014[/editline]

Please Help

Your issue is that Sounds is a nil value; it doesn’t equal anything. You can fix this by creating a Sounds table (Sounds = {value1, value2}) and putting the values you need there.

Thank you :slight_smile: