How Do I Make A Trading System?

I Want To Make A Trading System But There Is No Proper YouTube Tutorials Or Guides That I Can Understand Fully. I Don’t Know What To Do After Looking At Loads Of Tutorial And Having No Luck With It.

I Really Want To Make A Trading System Like Royale High And Have The Ability To Trade Hats And Them Save Between All Different Places Connected To A Single Place.
So If You Click Accept The Item Transfers And The Item Is Kept Throughout The Entire Game Or Each Mini Place In The Single Game.

Can Anyone Help And Guide Me Or Have A Good YouTube Tutorial ?

7 Likes

Creating a trading system is complicated, and many factors will have to go into a system like this. Having a trading system done incorrectly can be very negative for your game. Issues such as scamming, duplication, and players losing items if a trade goes wrong or unexpected bugs occur.

You are also missing key information if anyone did want to create or help you create a code for you. Which I highly do not suggest. Such as how do you handle your inventory system?

It sounds to me like you are wanting to jump to the deep end too soon. Perhaps you should take a second to sit back, work on other key things for your game. Create your own trading system once you really know how it works, so that if something does go wrong in the future you will know how to analyze the code and fix the issue.

Also don’t be hard on yourself, I mean very recently even Adopt Me! had to turn off their trading system due to bugs of duplication. No tutorial is going to help you with that.

I do wish you the best of luck on your project, keep at it!

10 Likes

You can send all this information in a table then index it on the other client. For example

– Client

local Item = {}
Item.Name = ‘Pet’
Item.Id = 0
Event:FireServer(‘AddItem’,plr1,plr2,Item)

– Server

function AddItem(…)
local plr1,pl2,item = …
– could verify whether the item is owned by plr1 incase they fire the event with an item they do not own
Event:FireClient(plr1,‘AddItem’,item)
Event:FireClient(plr2,‘AddItem’,Item)
end

Event.OnServerEvent:connect(function(request,…)
if request == ‘AddItem’ then
AddItem(…)
end
end)

– Client
function AddItem(…)
– Add item to ongoing trade
end

Event.OnClientEvent:connect(function(request,…)
if request == ‘AddItem’ then
AddItem(…)
end
end)

Credits to @DevPokey for the code.

If this helped, please mark it as a solution.

14 Likes