Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make a trading system?

Asked by 4 years ago

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:

  1. 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))

  2. 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).

  3. 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?

0
This is not a request site. We will not script this for you. But, we will give you tips and help you solve you're script issues. But, I would do it where they send a request first to trade, and then they both have a GUI where you can see what items they are sending and there's a time limit that counts down when you both agree. killerbrenden 1537 — 4y

1 answer

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

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

Also sorry for confusing sentences and grammar errors lol

Ad

Answer this question