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() help.

Previous Thread :: Next Thread 
yoshi1195 is not online. yoshi1195
Joined: 21 Dec 2011
Total Posts: 629
18 Apr 2014 11:17 AM
Can I use GetChildren() to get bricks? Or is it something else?
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
18 Apr 2014 11:19 AM
i = 0
--yes
for _,v in pairs(Workspace:GetChildren()) do
if v:IsA'BasePart' then
i = i+1
end
while wait(5) do
print(i.." bricks")
end
Report Abuse
yoshi1195 is not online. yoshi1195
Joined: 21 Dec 2011
Total Posts: 629
18 Apr 2014 11:22 AM
Then how come this script won't work.

local Roof = script.Parent.Parent.Glass:GetChildren()

function ToggleCeiling()
if script.Parent.Parent.State.Value == false then
script.Parent.Parent.State.Value = true
script.Parent.BrickColor = BrickColor.new("Bright red")
Roof.BrickColor = BrickColor.new("Really white")
Roof.Transparency = 0.7
Roof.Material = "Plastic"
else
script.Parent.Parent.State.Value = false
script.Parent.BrickColor = BrickColor.new("Bright green")
Roof.BrickColor = BrickColor.new("Really black")
Roof.Transparency = 0
Roof.Material = "Wood"
end
end

script.Parent.ClickDetector.MouseClick:connect(ToggleCeiling)
Report Abuse
TheProgrammingMaster is not online. TheProgrammingMaster
Joined: 20 Aug 2011
Total Posts: 7602
18 Apr 2014 11:23 AM
for v,i in pairs(workspace.Model:GetChildren())do
i:Destroy()
end
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
18 Apr 2014 11:23 AM
because :GetChildren() returns a table and then you're trying to change the color of a table.

loop through the table instead.

#nerdsunited
Report Abuse
yoshi1195 is not online. yoshi1195
Joined: 21 Dec 2011
Total Posts: 629
18 Apr 2014 11:26 AM
? Can someone just rewrite the script?
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