Hello! I need a-bit of help. I would like to make a trading system, I’ve looked up everywhere how too, but I just can’t get my head around it. I’d appreciate any help.
RemoteFunctions aren’t working for me (30 characters).
I think one way you could think of a way to create a trading system like Roblox’s is to have it work like this in a way.
So first the player requests to send a trade to another player in the server. The client is notified from the server that there’s a trade inbound for them and they can either accept or decline it.
Each trade is temporarily stored on the server until either trade partner leaves the server. You can store the data on these trades on the server in tables by ‘trade ids’ like 1, 2, 3 and so on…
Basically about all of the trading system is done on the server except for UI.
Let me know if that helps at all. It was confusing for me at first when I tried to learn something like this a couple years ago.
RemoteFunctions aren’t the issue, it’s how you’re putting them to use and they may not even be what you need. Might worth be understanding the client-server model and how remotes play into this first before tackling your system. You always want to get the knowledge bits out of the way first.
Trading systems are very much rooted to your game’s systems so finding a trading system tutorial would be fairly difficult. You can find threads related to the concept of trading or use any coding knowledge to work towards that though.
Hm, thank you for your accurate and concise answer. Do you know how I could do it though, like specifically what I could use?
I see, thanks! (30 characters).
script.Parent.MouseButton1Click:Connect(function()
local player = game:WaitForChild(script.Parent.Parent.TextBox.Text)
if player == nil then
print(“Is Nil”)
else if player ~= nil then
print(“Is Not Nil”)
end
end
end)
I’ve got a textbutton where you type the name in and I’m trying to basically get the player from there. How would I use this to fire a server and then talk back to the client?
game.Players* (30 characters is needed)
If you can’t understand where to start from my answer I’d suggest taking Colbert’s advice and learning how the client and server models work and then possibly try again after you’ve nailed it. Creating new features (like trading since it heavily relies on knowing how it all works) for your game really does become easier once you have learned how to use remotes.
This page might help out. https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events
I know how to use remotes and stuff. That’s all clear to me, what’s not clear is how I’d implement that into a trading GUI.
Thanks for your help though :)!
To let the client know that the trade was successfully sent you can invoke a RemoteFunction, have the server listen for the input from it, and then return a value inside of the function back to the player, for example true if the trade was properly sent to the other player or false if something went wrong in the process.
You can then update the UI on the client depending on which value you get returned.
Absolutely perfect idea. Thank you so much! Have a great day! That solved it