You know a chat Gui? How it adds a new frame every time a player chats and removes the top one?
Well I'm trying to do the same thing but opposite, when a player presses a text button it will add there name to a surface Gui list in order of the click.
Example:
IntellectualBeing - Clicks the Text button, IntellectualBeing's name is now on the SurfaceGui list.
Then Jim person clicks the Textbutton, Jim's name is now on the top of the list and IntellectualBeing's is one below the second person that clicked (Jim)
Now if Jen clicks the text button, Jen's name will be on the list replacing Jim's name and IntellectualBeing's name will be replaced with Jims.
Example - continued
Adding a frame
1.IntellectualBeing
Adding a second frame
Final event, removing/replacing
How would I even begin doing this? What should I need to know about?
I already know how to do onmousebutton1 down functions and all of that though.
Hmm... Her's what I think you should do.
Given that the SurfaceGUI does not scroll, there should be a set number of frames that can be visible on the SurfaceGUI at the time. Each frame should have a TextLabel in them. This means that each frame could be updated through scripts.
What I would do is create separate StringValues
for each Label. The values should be equal to the Text of the Label it is linked to.
Upon clicking a button, a script can be used that will take the CURRENT StringValues, and use them to replace the CURRENT text within the TextLabels.
Ex)
--Make sure that the script is inside the SurfaceGUI itself; the TextLabels themselves do not have to be in a frame for this to work, but you can add frames, just remember to change the variables a little. local string1 = script.Parent.StringValue1 local string2 = script.Parent.StringValue2 local label1 = script.Parent.TextLabel1 local label2 = script.Parent.TextLabel2 function getCurrentText() --This will get the text of whatever is currently in the Labels BEFORE adding a name to the list string1.Value = label1.Text string2.Value = label2.text end function updateText(plr)--Change the texts after being updated. label1.Text = plr.Name --Adds a new name to the list label2.Text = string1.Value --Sets the name of the previous label to itself wait(2) getCurrentText() end script.Parent.MouseButton1Click:connect(updateText)
This is a very rough example and it is not intended to work, but I hope it brings clarity. This is the way I would do it, and I'm sure there are many different ways to solve your problem.
First of all, you need to know two functions before you even think about doing a chat gui.
You need to know these functions:
function onPlayerAdded()
function onChatted()