generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Hey there

Previous Thread :: Next Thread 
IceOrb is not online. 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 is not online. 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 is not online. 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
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
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 is not online. 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
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image