Attempted to call method (a nil value)

So i did this

concommand.Add("XriX_GiveAmmo", function()

and got this

attempt to call method 'SetClip1' (a nil value)

and outside of the function i have this

ply = LocalPlayer()

What the poop is a nil value and how to fix?

I assume that you can’t call it from clientside.
You need some way to from client, inform server to set clip1 for ply to 9999.

It also needs to be called on the weapon ( you could use PLAYER:GetActiveWeapon( ) to get a weapon entity that the player is currently holding ), not the player.