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

How do I make a GUI that lists things in order with a table? [closed]

Asked by 6 years ago
Edited 6 years ago

Alright, I want to make a GUI with a list of teams a person can join based on what group they are in. I want it to remove each TextButton if they are not in the group, but still be in order, and expand to a scrolling frame if needed. Does anyone know how to do this? I know to use tables but the wiki confused me, so if someone could explain it I would appreciate it.

0
Your confusing me. hiimgoodpack 2009 — 6y

Closed as Not Constructive by PyccknnXakep, IcyEvil, and ImageLabel

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 6 years ago

First off, not related to the question... DONT USE A CODE BLOCK FOR ANYTHING OTHER THAN CODE. That should be self-explanatory.

Second of all, just a tip for you, if you cant do something, try improvising and going another route, just as i am about to show you.

Ok, lets get started

So, yes we could do this with a table, but you should know how you are complicating this.

Essentially, your way, We would first have a table with all possible team choices, then check the players group, then use an algorythm to determine what groups to remove, then remove them. Then loop through the whole table and create buttons based on the data in the table.

You know how we could simplify this?

Create a bunch of premade GUI's for each group a person is in (using scrolling frames for ones that need it). Then have a script that checks if the person is in that group, then give the correspoding GUI menu.

Boom.

Now, if say, you have a BUNCH of groups, like 10, then it would make sense to do it your way, but if you dont, make it easy on you buddy. Here is some code to get you started on your way

--YOUR WAY
Teamslist= {Memelords, ultramemes, shrek, potato, carrot, celery , dog, cat, mouse}

Hitlist={}
--In these hitlists, put the teams you want each group to join from the teams list


Memehitlist= {1,2,3}
Veggiehitlist = {4,5,6}
animalhitlist = {7,8,9}


Groupid1= 29873492
Groupid2=2309840923
Groupid3=02734023
--etc

game.Players.PlayerAdded:Connect(function(newPlayer)
if newPlayer:IsInGroup(Groupid1) then
Hitlist = Memehitlist
end
if newPlayer:IsInGroup(Groupid2) then
Hitlist = Veggiehitlist
end
if newPlayer:IsInGroup(Groupid3) then
Hitlist = animalhitlist
end

killlist = {}

for i=1, #Teamslist do      
   for d=1, #Hitlist do
   if i ~= Hitlist[d] then
   table.insert(killlist, i)
   end
   end
end

for i = 1, #killlist do
for d = 1, #killlist do
if i < d then
killlist[d] = killlist[d] -1
end
end
table.remove(Teamslist, killist[i])
end

--Now here, do what you want. The variable (teamslist) now has every team option the player should have. I cant give you code after this. BEWARE, my code is not tested and may have errors, but im confident most of the errors would be spelling. 


end)


Ad