IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 25 Sep 2013 04:09 PM |
So I have a text label, and I want it to display the text of two buttons that are clicked within the same frame. For example, if I click within the button with the text "GUN" and a button with the text "SWORD" the text label will display both "GUN - SWORD". It's so that it displays the weapons that have been chosen? How would I do so? |
|
|
| Report Abuse |
|
|
Zomebody
|
  |
| Joined: 01 Jun 2010 |
| Total Posts: 789 |
|
|
| 25 Sep 2013 04:22 PM |
Insert 2 StringValues into the TextLabel. Make one button change the first StringValue its Value and make the other button change the second StringValue its Value. Then put a script inside the TextLabel that uses the Changed() event. Use that to connect the first StringValue's Value with the second StringValue's Value. You should get something like this:
TextLabel - StringValueA - StringValueB - Script
And the script should be something like:
function Update() script.Parent.Text = script.Parent.StringValueA.Value..script.Parent.StringValueB.Value end
script.Parent.StringValueA.Changed:connect(Update) script.Parent.StringValueB.Changed:connect(Update) |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 26 Sep 2013 09:38 AM |
What if there is more than 2 buttons? Basically, I will have like a series of buttons displaying weapon names within a frame. Once I click on one button, it changes the text to that button name so the user knows that the current selected first weapon is, let's say, a SWORD. Then they click another button, possibly, SNIPER, then it shows, "SWORD - SNIPER". If they click something else, it changes one of the values. It's so that, once they have selected the two desired weapons, they click "LOAD" and it clones those weapons and gives it to the players. (I can do this bit) |
|
|
| Report Abuse |
|
|
|
| 26 Sep 2013 09:43 AM |
i am to lazy to read all that can you make it shorter pls
tnx :D |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 26 Sep 2013 09:47 AM |
Basically, I have buttons within a frame and they all show the name of a weapon. The trainer will click 2 weapons out of this list and then a text label displays the 2 weapons selected. |
|
|
| Report Abuse |
|
|
|
| 26 Sep 2013 09:59 AM |
local label1 = script.Parent.Label1 local label2 = script.Parent.Label2 local db2 = false for i,v in pairs (script.Parent:GetChildren())do if v:IsA("TextButton") then v.MouseButton1Click:connect(function(button) if label1.Text == ""then label1.Text = button.Text elseif label2.Text == "" then label2.Text = button.Text end end) end end
idk if this work you need 2 labels and when button clicked if label1 is empty label1 is going to display button thats clicked text if not then label2 is going to display it
|
|
|
| Report Abuse |
|
|