Derma button

I need help with a button function.

Clicker.DoClick = function()

in between this function.

I would like so when player press the button it gives or take your ingame money, and than gives you a weapon or entity.
I think this one is helpful not sure about weapons/entities…

Use net messages

Can you maybe help with it i hate net messaging…

Have you tried looking over this page?

I tried and i tried sorry but i dont get it haha:) Can you just show me a case with it maybe.

Derma is always Clientside, so you would have to send some data ( amount of money or whatever) TO the server. The function for that is net.SendToServer(). Then you would use a net.Receive() on the Serverside file to grab that data and do something

I heard same all story over and over thank you i would appreciate an example. I know you all know how to do it now pls show me so we can laugh together :smiley:

There are examples on that page, people AREN’T gonna spoonfeed you.

Clicker.DoClick = function()
	start the net message
	add whatever u want to it, floats, strings, tables, entities etc using net.Writexxxxx
	send the net message to the server

[lua]button.DoClick = function() net.Start(“example”) net.SendToServer()[/lua]

Sending “Example” to the server

Then serverside


net.Receive(“example”, function(len, ply)
if ply:canAfford(100) then
return false

Think this will work, wrote it in here so…

It seems somebody has to say this on every single ‘Lua Help’ thread these days.

Right, Garry’s Mod utilises the scripting language Lua and adds a API for you, the developer, to interact with the game. It is virtually impossible to effectively code for Garry’s Mod if you are not already fully comfortable with programming concepts and their use in Lua.

Firstly, I suggest you look into learning how to code before jumping into Garry’s Mod. I have come across a shocking amount of people who have developed a wide range of bad habits and misconceptions from learning to code directly in Garry’s Mod. Once you know how to code and develop the mind-set for it all; you should then jump into learning the Garry’s Mod API :3

(Also for those who know more than me, am I right in referring to the Garry’s Mod ‘API’ as an API? It doesn’t seem like it suits.)

-snip w/e-

It’s nothing like that. It’s like saying, if you can’t already drive a car; you can’t race one. At least not without encountering a wide range of issues.

-snip w/e-

Tnx #Invule for this. Appreciate it.