Derma Question

So I made a Button on my derma menu that gives the player guns when clicked. How can I get it to take money from the player when clicked as well? And how can I limit the button to one team such as CP?

Name.DoClick = function
and there you call your take money function.

Thanks man but what is the take money function?

player:addMoney

[lua]
local cost = price
if LocalPLayer().isCP and ply:canAfford(cost) then
player:addMoney(-price)
—[[
Rest of code
–]]
end

[/lua]

I have not tested that but I think it will work.

Won’t work addmoney is serverside and you haven’t defined ply.

Regardless if you use console commands or networking to do this, make sure you do serverside checks as well.

How do I limit it to one team?