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: GetChildren

Previous Thread :: Next Thread 
IRyan70 is not online. IRyan70
Joined: 08 Jun 2011
Total Posts: 484
16 Aug 2014 03:54 PM
Say i have a gui frame "m2" and i want all the objects in m2 to fade there transparency. I was gonna use a loop, and i know getchildren makes a table with all of the children, but how do i call the table? Like...
for _ = 1, #TableNameHere do
end blah blah
But how do i know what the tables name is or how do i set it?

Do i do m2:GetChildren(Table1) --?
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
16 Aug 2014 03:55 PM
If you use ":GetChildren()", it returns the table of the object.
Report Abuse
IRyan70 is not online. IRyan70
Joined: 08 Jun 2011
Total Posts: 484
16 Aug 2014 03:57 PM
Ok so how can i make all the text labels in m2 into Transparency 0? But fading
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
16 Aug 2014 03:59 PM
You could try using something such as,
for _ = 1, #TableNameHere:GetChildren() do
if TableNameHere[_].ClassName == "TextLabel" then
--More Code Here
end
end
Report Abuse
IRyan70 is not online. IRyan70
Joined: 08 Jun 2011
Total Posts: 484
16 Aug 2014 04:09 PM
Error- 1 is not a valid member of Frame
I guess the error is on "THISLINE"

pl.MouseButton1Click:connect(function()
for _ = 1, #m2:GetChildren() do
if m2[_].ClassName == "TextLabel" or m2[_].ClassName == "TextButton" then--THISLINE
m2[_].BackGroundTransparency = m2[_].BackGroundTransparency + 0.1
wait(0.1)
end
end
end)

PS-m2 is the frame with the labels and buttons
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
16 Aug 2014 04:17 PM
Alternatively,
for v,_ in pairs(m2:GetChildren()) do
if _.ClassName == "TextLabel" or _.ClassName == "TextButton" then
_.BackGroundTransparency = _.BackgroundTransparency + 0.1
wait(0.1)
end
end
Report Abuse
IRyan70 is not online. IRyan70
Joined: 08 Jun 2011
Total Posts: 484
16 Aug 2014 04:22 PM
Ok so it works, but i need to click once, and it makes them fully invisible
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
16 Aug 2014 04:27 PM
_.Visible = false
Report Abuse
IRyan70 is not online. IRyan70
Joined: 08 Jun 2011
Total Posts: 484
16 Aug 2014 05:02 PM
No no its like i have to click play 10 times to make it invisible
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
16 Aug 2014 05:06 PM
That's because of the 0.1
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
16 Aug 2014 05:12 PM
Actually you could try something such as,
for i = _.Transparency,1 do
wait(1)
_.Transparency = _.Transparency+0.1
end
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
16 Aug 2014 05:13 PM
clicked = 0
pl.MouseButton1Click:connect(function()
clicked = clicked+1
if clicked == 10 then
for _ = 1, #m2:GetChildren() do
if m2[_].ClassName == "TextLabel" or m2[_].ClassName == "TextButton" then--THISLINE
m2[_].BackGroundTransparency = m2[_].BackGroundTransparency + 0.1
wait(0.1)
end
end
end
end)
Report Abuse
IRyan70 is not online. IRyan70
Joined: 08 Jun 2011
Total Posts: 484
16 Aug 2014 06:47 PM
I only want to click the play button once, and all the children of m2 (a frame) slowly turn invisible (transparent)
Report Abuse
IRyan70 is not online. IRyan70
Joined: 08 Jun 2011
Total Posts: 484
17 Aug 2014 09:43 AM
Bump
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
17 Aug 2014 09:48 AM
Make it so that it runs a for loop after you've clicked it once.

script.Parent.MouseButton1Down:connect(function() --or whatever you're using
for whatever blah end
end)
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
17 Aug 2014 10:28 AM
Too many hints n' clues.
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