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: Gui to change color help.

Previous Thread :: Next Thread 
NeonKitty is not online. NeonKitty
Joined: 19 Aug 2010
Total Posts: 87
01 Aug 2013 09:52 PM
I made a gui that if you select the color, then the torso color becomes the buttons background color. The problem is that i need to put a script in each individual button to do this. Is there a way i can make it just one script so that the player's torso color = the background color of the gui button clicked?
Report Abuse
IAmReallyAwesome is not online. IAmReallyAwesome
Joined: 05 Mar 2010
Total Posts: 7371
01 Aug 2013 10:05 PM
Make this script be a child of the label/frame where all the buttons are located.

for i,v in pairs (script.Parent:GetChildren()) do
if v:IsA("TextButton") then
v.MouseButton1Click:connect(function(player) --I believe that player is what this documents, but it might be mouse.
player.Character.Torso.Color = v.BackgroundColor --Might need to fix caps.
end
end

--I think this will work, but I'm not completely sure. Let me know what happens XD

*Tell me about the rabbits, George*
Report Abuse
NeonKitty is not online. NeonKitty
Joined: 19 Aug 2010
Total Posts: 87
01 Aug 2013 10:16 PM
The last end is underlined in red and says
") expected (to close '(' at line 3 near 'end'"

what does that mean?
Report Abuse
NeonKitty is not online. NeonKitty
Joined: 19 Aug 2010
Total Posts: 87
01 Aug 2013 10:26 PM
Oh wait... how would I do it if all the text buttons are in frames.. is there a way to get the child of a child???
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
01 Aug 2013 10:36 PM
Second end should look like: end)

"is there a way to get the child of a child???"
parent.child.child--?
Report Abuse
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
01 Aug 2013 10:39 PM
Heres how:

for _,v in pairs(script.Parent:GetChildren()) do
if v:IsA("Frame") then
for _,x in pairs(v:GetChildren()) do
if x:IsA("TextButton") then
x.MouseButton1Down:connect(function ()
game.Players.LocalPlayer.Character:WaitForChild("Torso").BrickColor = BrickColor.new(x.BackgroundColor3)
end)
end
end
end
end

(Note, this should be used in a LocalScript
Report Abuse
NeonKitty is not online. NeonKitty
Joined: 19 Aug 2010
Total Posts: 87
01 Aug 2013 10:43 PM
There are a bunch of frames each with a text button. I want to manipulate all the text buttons so that if you click it, then something can change color to the text button's background color.
Report Abuse
NeonKitty is not online. NeonKitty
Joined: 19 Aug 2010
Total Posts: 87
01 Aug 2013 10:44 PM
Oh thanks
Report Abuse
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
01 Aug 2013 10:45 PM
That's exactly what my script does.

Lets say the parent of each of the frames you are trying to get is parented to a screenGui

My script locates each frames and adds a torso color change event to each textbutton it finds within those frames.
Report Abuse
NeonKitty is not online. NeonKitty
Joined: 19 Aug 2010
Total Posts: 87
01 Aug 2013 10:52 PM
OMG THANK YOU SO MUCH CLONE NOW I CAN REDUCE LAG YAAAAAY!!!
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