I have the following code:
function SWEP:Initialize() local ply = self.Owner local wep = self.Weapon hook.Add("Tick","MySWEP.Tick",function() local On = ply:GetNWBool("DamageOn",false) if On then if ply:GetNWInt("Counter",0)>=10 then print("Player should have took damage.") ply:SetNWInt("Counter",0) if SERVER then ply:TakeDamage(1,ply,wep) end else ply:SetNWInt("Counter",ply:GetNWInt("Counter",0)+1) end end end)
Through prints, I have discovered that the counter does work. However, the damage does not work. Why not?
[editline]30th April 2016[/editline]
I realize it has to do with ply and wep, but I don’t understand why those don’t work. Is there a workaround?