I tried making a trading system and I do not know a better way to send the request to the player. I don't know a better way to send requests.
Here is my solution of the request sending:
A player would fire an event with the following arguments (item (the item), item2 (the item the trader is willing to give), amount (the amount of that item), playerName (the player that is going to be receiving the request))
OnServerEvent:
Once the remote is fired, it would clone the request gui (Accept/Decline) and it will make the request gui visible for the player that will be receiving it (playerName).
If the player accepts it, the script will subtract (item2) from the trader then it will add (item) to the trader while the receiving player would have (item) subtracted from them and (item2) added to the receiving player. The gui would be invisible again. (Hopefully this makes sense)
Any thoughts of how I should improve this?
A trade is making player1 items and the player2 items changed when they both agree, you can fire an event if someone agreed, so there'll be a countdown.
In a nutshell, we need 8 events in the trading system:
*Example, like when player1 send a trade to player2, the player2's PlayerGui
might fire an event, also note, PlayerGui only works in LocalScript.
*When player1 send to player2 a trade, but player2 declined at first that the trade has sent.
*When player1 send to player2 a trade, and player2 accepted the trade.
*When player1 and player2 are trading, someone declined.
*When someone has sent something that he wants to trade.
*When someone have undo'd theirs thing that they wanted to trade to another person.
*When player1 and player2 are trading, someone has agreed, so there might have a countdown on.
*When both were accepted, the trading system will give player1 item to player2 backpack, and player2 items to player1 backpack.
Also note, ignore the countdown if you don't want.
Simply, the trade is like this. We need 4 variables.
There has variable called item1, item2, player1, and player2.
Simply, the script concept is maybe works like this:
-- if both accepted item1.TradeItems = player2.Backpack item2.TradeItems = player1.BackPack
If you need other ideas or concepts, ask at the comment, or PM me, so cya later, bye <3