PS_GiveItem function

Hello, I was trying to make some derma based NPCs that sell Pointshop items.
The function used to give items in Pointshop is ply:PS_GiveItem(itemid) So, I tried doing something like this:

pShopButt.DoClick = function( Player )

However I got: attempt to call method ‘PS_GiveItem’ (a nil value)
I also tried adding if SERVER and if CLIENT then statements to the beginning but no avail.

Any help would be great, thanks!

You are trying to call serverside functions on the client.

You will need to do some networking.

Shit, any general idea on how I should get that started?

Use the net library.

Start a net message with the item name to the server, on the server read the item name and give it to the player who sent the net message (second argument in the net.Receive callback).
Since it’s on the server, you can also do some validation to check that the player meets the criteria to obtain the item, etc.

Got it! Thank you very much :3