Player.GiveAmmo fails in SWEPs?

I’m not sure why using Player.GiveAmmo in a SWEP will result in an error. Am I doin’ it rite?
In function SWEP:Initialize():

[lua] if (SERVER) then
self.Owner:GiveAmmo(14, CombineCannon, true)

This results in the error (serverside, referring to the lines above):

attempt to call method ‘GiveAmmo’ (a nil value).

Note that doing something similar in a SENT with Player.GiveAmmo works fine.

Any help regarding this is appreciated, thanks!

That code should work perfectly well. Maybe if you posted the whole code we’d find something you missed.

Okay, never mind this. According to the wiki, self.Owner doesn’t exist when SWEP:Initialize is called. My bad. :saddowns:

I remember this just coming up in another thread on here… I believe the solution found was to input a manual delay of .1 or .2 seconds (to give time for self.Owner to come into play, I suppose)? Anyways give it a shot.