How would I send a trade request to another player?

Hey guys,

I’m trying to create a trading system for my simulator game, but I’m having issues with how to “send requests” to other players.

The goal is to make a GUI appear on the person’s screen when they are sent a trade request. I’ve tried multiple methods of doing this but none have worked.
I tried storing the player who is receiving the trade’s name in a strong value, like this:

unknown (1)

Then I tried to access the player’s playerGUI by finding the player from the string value.

None of the methods I’ve tried have worked yet. I’m not a very advanced scripter at all so any tips or advice is appreciated. Thanks!

You’ll need to use RemoteEvent instances, one to fire the server from this local script and another to fire the client which is being traded from the server.

1 Like

Trading systems are difficult to make and need to be scripted properly. If your system is not coded well, an exploiter can duplicate items and basically give themselves everything. There are tutorials out there on how to make trading systems, but none are very good. This is the type of system that is different for every game and you need to script this yourself.

However, I would suggest using RemoteEvents to tell the respective player that someone has sent them a trade request. Also, for extra security, make sure that the items being traded actually are owned by the respective players. Check this on the server.

3 Likes

Make sure all trade requests are being handled and checked by the server to avoid exploitation, as trading systems in most games end up being pwned at one point or another.

A basic trading system might work like the following…

  1. Player A uses his local GUI to create a trade
  2. Player A hits send, and a request is sent to the server to validate the trade.
  3. The server checks if Player A has the items he wishes to trade, and Player B has the items Player A wishes to receive.
  4. The trade has now been validated. The server will now send the trade to player B to accept.
  5. After Player B accepts the trade on his Local Gui, the server once again checks the validity of the trade.
  6. If the trade was again validated, then the server can complete the trade, and swap items between the players.

TLDR: Anything important (like trading items) should be handled and checked by the server.

2 Likes