|
| 09 Jun 2013 10:16 PM |
for i,v in pairs(game.Workspace:GetChildren()) do if v.Name=="x" then game.Workspace.x.SB.Adornee = game.Workspace.x game.Workspace.x.SB.Color = BrickColor.new ("Institutional white") end end
(SB is the name of the SelectionBox)
Ok so it only edits the properties of the first part named that has a child named SB. I want it to go through all of the parts named x with a child of SB and change the Adornee and BrickColor. Help? |
|
|
| Report Abuse |
|
|
Ozzypig
|
  |
| Joined: 27 Mar 2008 |
| Total Posts: 4906 |
|
|
| 09 Jun 2013 10:18 PM |
In the for-block, "v" refers to the the current value it is iterating on. Use that instead of indexing game.Workspace.x again. Like this:
for i,v in pairs(game.Workspace:GetChildren()) do if v.Name=="x" then v.SB.Adornee = v v.SB.Color = BrickColor.new ("Institutional white") end end |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2013 10:19 PM |
| Why don't you make the SelectionBox's color white already just a question not a suggestion sorry. |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2013 10:20 PM |
| 22:19:52.922 - v is not a valid member of Workspace |
|
|
| Report Abuse |
|
|
| |
|
|
| 09 Jun 2013 10:29 PM |
| It's is only changing the properties of one of the x's |
|
|
| Report Abuse |
|
|
2unknown2
|
  |
| Joined: 30 Oct 2011 |
| Total Posts: 9351 |
|
|
| 09 Jun 2013 10:36 PM |
for i,v in pairs(game.Workspace:GetChildren()) do if v.ClassName == "Part" and v.Name == "x" then game.Workspace.x.SB.Adornee = game.Workspace.x game.Workspace.x.SB.BrickColor = BrickColor.new ("Institutional white") end end
Certified Scripter |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2013 10:41 PM |
| Now explain to me what ClassName is? Is it the actual normal thing that Instance calls it? So the ClassName of my "x" would be Part? |
|
|
| Report Abuse |
|
|
| |
|
|
| 09 Jun 2013 10:47 PM |
| It's still only editing the Adornee of one of the SB's... |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2013 10:49 PM |
v == to one of the x. and game.Workspace.x == the other x |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 09 Jun 2013 11:02 PM |
this is all wrong how are you going to set something to be it's own adornee |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2013 11:04 PM |
Ugh, here's the script i have right now....
for i,v in pairs(game.Workspace:GetChildren()) do if v.ClassName == "Part" and v.Name == "x" then v.SB.Adornee = game.Workspace.x v.SB.Color = BrickColor.new ("Institutional white") end end
|
|
|
| Report Abuse |
|
|
|
| 09 Jun 2013 11:06 PM |
i still don't get it your trying to find the part "x" then your trying to set "x"'s adornee to "x" |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2013 11:09 PM |
I've set the pairs to x so that i can select all of the part's that are named x and then select their children named SB and then change their adornee's to v
i meant to put v there but put x instead, and btw my friend fixed it on XF
here is the fixed script
for i,v in pairs(game.Workspace:GetChildren()) do if v.ClassName == "Part" and v.Name == "x" then v.SB.Adornee = v v.SB.Color = BrickColor.new ("Institutional white") end end
|
|
|
| Report Abuse |
|
|
|
| 09 Jun 2013 11:15 PM |
for i,v in pairs(game.Workspace:GetChildren()) do if v.ClassName == "Part" and v.Name == "x" then if v.SB.Adornee ~= v then v.SB.Adornee = v v.SB.Color = BrickColor.new ("Institutional white") v.Transparency = 1 else while wait() do for i = 1,10 do v.CFrame = v.CFrame*CFrame.new(0,i,0) wait() v.CFrame = v.CFrame*CFrame.new(0,-i,0) end end end end end
I added onto it to make it float up and down but it doesn't seem to float? |
|
|
| Report Abuse |
|
|