Making a Order GUI

@AwesomeXForLife
Hello,

I got an order script for the system but how do I check if there already is an order and if there is that the next button needs to be visible instead of the same? And if the first order gets clicked how do I make it that the TextButton which contains the other order that that one is going to the place that firstly had the original first one?

Hope this is explained well, ask if you need more information!

2 Likes

Dont know what quite your asking, try to provide some more infromation.

How are you communicating the orders? What code are you using that shows that causes the core issue?

There isn’t really an core issue its just that I don’t really know how I can make it happen.

To go more in details:

  • There are 10 TextButtons which contains orders

  • If the first TextButton is visible and another order comes out of the order generator script then the TextButton next to the first TextButton needs to show up with that specific order and so on.

  • If the first order gets clicked and there are more orders visible they all need to go one place left so there won’t be any empty places in the Frame.

Hope you understand it more now, believe me for me it already is hard to understand.

For example;

--code which contains the random time

local ordersVisible = {}

if ordersVisible[//the first button/OrderButton\\] then
   -- next button is visible
end

Should something like that work?

To fix the 3rd issue you can use a UIListLayout which will do the job for you. To check if a player already has an order you could use a table with their name inside and then remove it when the order is completed.

1 Like

Problems on using UIListLayout:

Frame

You can only put a limit depending of the size.

Scroll Frame

• Adding orders and orders will stretched the orders ui to smallest y(0)

How to fix the stretching ui

You have to make the ui size to X: Scale and Y: Offset, for instance

UDim2.new(1, 0,0, 50)

Problems doing this:
Will create unexpected size for non-same device as you. Instead, to fix this: you have to script it where it detects what device they have and change the instance creator size offset to what you want

• If you won’t use AutomaticCanvasSize you’ll just have orders limit depending on order size and canva size

Can you show me how that works cause I’ve never heard of it. You don’t need to make a full script just something to explain so I can understand it.

UIListLayout
Changes the childs position automatically without you changing it 1 by 1. For instance,
With UIListLayout
Perfectly aligned

Without UIListLayout(Manually changing the position)
Not perfectly aligned

Did you just draw this to make me jealous

1 Like

Excuse me? I don’t understand?

You could have Values placed somewhere that contains the players order, you can change the order items by clicking the buttons obviously, and then after that you should be done, you can check what the order of the player is via the Values!

Example:

local Item1= "Hamburber"
local Item1Val = WhereEverYourValueIs
local ItemButton1 = script.Parent

Script.Parent.Activated:Connect(function()
 Item1Val.Value = Item1
end)

Use table.insert() and table.remove() to add and remove the player’s username from the table. Take a look at this documentation for more information about tables.

Alright, I guess that the black rectangle is the TextButton? But i’m not quite sure what the red thingies are. Can you tell me what they are?

I think you misunderstand what I meant.(not sure so don’t blame me if i’m wrong)

What I mean is that the order = an order like ordering a new computer. And the purpose of the game is that you need to sell stuff and thats why I need a randomized order system so the player’s can sell their stuff.

I really think that I missed something but hopefully you can explain it. Why do I need to use table.insert() and table.remove()? Is this so the TextButtons move places if another one gets clicked?

To all of u sorry that I respond so late!

they are the length/ padding in position, since I’m now on the computer, I’ll give you an example

With UiListLayout:
image

Without UiListLayout:
image

if you look closely, you can see that some of the text button are near from the middle button and the other button was bit far from the middle button.

if you use a table script, this will make you write long script since you want to use table to add users order

(Bonus) when adding a value at string

Tables
You just use the table function to edit the table, nothing much, you can’t really use

Table.valuename

it will just came an error because you didn’t put “= value” unto it.

Adding a index in dictionary
You don’t use table.insert or any table to add a index. To add a index you should make it:

dictionaryname.indexname = {}
-- or
dictionaryname.indexname = "Cool string!"
1 Like

No, table.insert() and table.remove() would be used to check if the player already has an order being made. Please refer to the documentation as it provides codes examples and their explanation.

In the past, I have an ordering system for myself just for fun and this is how I manage to display the orders (since I think that’s what you are trying to do; if not, please tell me).
Roblox Studio (gyazo.com)
As you can see in the GIF above, when the player clicks “Claim order” the order gets claimed and the frame deleted. You could achieve this by creating a template frame and cloning it each time a new order is made.

1 Like

That’s exactly what i’m looking for. And I think that with all the information I have now I no longer need help!!

All of u thanks for your help!

1 Like