TTT Creating the Gold Gun running into issues.

Hi there, I been in the process in making a gun in Trouble in Terrorist Town which kills Traitors instantly and does not harm Innocents or Detectives. I have created a base line weapon how ever I am running into a propblems with the function I created for testing the weapon. Here is the code:





function SWEP:Damage(ply)

	if ply:ROLE_TRAITOR then
	
		ply:ChatPrint("The Player you shot was a Traitor!")
	return SWEP.Primary.Damage = 100
	
	
	end
	
end 




Perharps you can tell me were I am going wrong? Here is my error I am receiving from G-mod:



[ERROR] gamemodes/terrortown/entities/weapons/goldgun.lua:40: function arguments expected near 'then'
  1. unknown - gamemodes/terrortown/entities/weapons/goldgun.lua:0




Thanks for the Help!

Your code isn’t syntactically correct in a lot of places, but anyway, it would be best to use a

GM:EntityTakeDamage to scale the damage. Ex.


hook.Add("EntityTakeDamage", "GoldenGun", function(pEntity, dmg)
   if (pEntity:IsPlayer() and pEntity:IsTraitor()) then
      local pWeapon = dmg:GetInflictor()
      
      if (pWeapon:IsValid() and pWeapon:GetClass() == "goldgun") then
         pEntity:Kill() -- Make sure they die, regardless of their health
      end
   end
end)