Unknown Command "!addmoney"

Hello There!
I’ve followed a money system tutorial - and now I want to create a command that will add money for debugging purposes. However, I’m failing at creating the command, and I don’t know what I’m doing wrong.
Here’s the relevant bit of code, but if you need more, I’d be glad to provide.



function meta:AddMoney(args)
	local current_cash = self:GetMoney()
	self:SetMoney( current_cash + args[1] )
end
concommand.Add( "!addmoney", meta:AddMoney )


What am I doing wrong, and how would I fix it?
Thanks!

I think you need to do
[lua]
concommand.Add( “!addmoney”, meta:AddMoney() )
[/lua]

Nope. Still getting - Unknown Command: “!addmoney”

[lua]
concommand.Add( “!addmoney”,function(args)
local current_cash = self:GetMoney()
self:SetMoney( current_cash + args[1] )
end )
[/lua]

I am not very good at coding, but I can try :slight_smile:

I guess that could work, but I’d have to work around it with NPC shops and such.
I’ll edit this post once my server is restarted, and tell you if it works for what I currently need.

EDIT: Works like a charm. Thanks a bunch.