Removing money

How would I remove money from a player if he runs a command? (Sorry for such a rubbish question, trying to learn lua)

[lua]
function TakeMoney( Player )
if Player (does bla bla) then
Player:AddMoney(-500)
end
[/lua]

That is all I can figure out w/o asking for help

This is using DarkRP? If so it would look something like this

[lua]function TakeMoney( ply )
ply:AddMoney(-amount)
end
concommand.Add(“money”, TakeMoney)[/lua]

But could I ask what this is for?

function TakeMoney( Player )
    if Player (does bla bla) then
    Player:SetMoney(Player:GetMoney() - 500)
    end
end

Maybe like this, but i dont know i am new to lua too

No.

Okay. That is part of the META table.

The question is, how would I implement a console command into the function. The code is all done, I just don’t know how to implent the “if, then” statement with it calling a command