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
 

Is there any way to sort bricks of a model by color?

Previous Thread :: Next Thread 
sergiu8957 is not online. sergiu8957
Joined: 01 Dec 2008
Total Posts: 607
23 Mar 2014 09:18 AM
I have this huge model and I need to edit some colors individually, but they're all in a jumble. I can't really do it manually since the scrollbar is literally a square when the model is opened. What I'm asking for is something that changed the order of the bricks in a model, or puts them into several subcategories for colors. If anybody knows something that does that, please tell me.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
23 Mar 2014 09:38 AM
Colors = {}
DidItHappen = true
Model = PATHTOMODEL
ch = Model:GetChildren()
for I = 1,#ch do
Color = ch[I].BrickColor
for I = 1,#Colors do
if Colors[I] == Color then
DidItHappen = false
end
end
if DidItHappen == true then
M = Instance.new("Model", Model)
M.Name = Color
elseif DidItHappen == false then
ch[I].Parent = Model:FindFirstChild(Color)
end
end


Test that, try it.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
23 Mar 2014 09:47 AM
Or...

Colors = {}
ColorExists = false
Model = PATHTOMODEL
ch = Model:GetChildren()
for I = 1,#ch do
ch[I].Name = ch[I].BrickColor
end
for I = 1,#ch do
for O = 1,#Colors do
if Model:FindFirstChild(Colors[O]) then
ColorExists = true
end
if ColorExists == true then
ch[I].Parent = Model[ch.Name]
elseif ColorExists == false then
M = Instance.new("Model", Model)
M.Name = ch[ch.Name]
ch[I].Parent = M
end
end
end


Try that one first.
Report Abuse
sergiu8957 is not online. sergiu8957
Joined: 01 Dec 2008
Total Posts: 607
23 Mar 2014 10:35 AM
It doesn't work, I tried them both and nothing happens to the model at all.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
23 Mar 2014 10:44 AM
You did run it right?
Report Abuse
sergiu8957 is not online. sergiu8957
Joined: 01 Dec 2008
Total Posts: 607
23 Mar 2014 11:25 AM
Yes, I put it in Workspace, completed the model path and tried the color list with both color codes and names.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
23 Mar 2014 11:40 AM
The second should have worked. Sorry.
Report Abuse
sergiu8957 is not online. sergiu8957
Joined: 01 Dec 2008
Total Posts: 607
23 Mar 2014 11:42 AM
It's alright, I'll see if there's something I can do or if I can figure out why it doesn't work but I'm not that good with scripts.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
23 Mar 2014 11:51 AM
Lemme try something else

Model = PATHTOMODEL
C = Model:GetChildren()
print("Success 1.")
for I = 1,#C do
C[I].Name = C[I].BrickColor
end
print("Success 2.")
Model = PATHTOMODEL
C = Model:GetChildren()
print("Success 3.")
A = 0
for I = 1,#C do
if Model:FindFirstChild(C[I].Name) then
C[I].Parent = Model[C[I].Name]
A = I + 3
print("Success ".. A ..".")
else
M = Instance.new("Model", Model)
M.Name = C[I].Name
C[I].Parent = M
print("Success ".. I + A ..".")
end
end
print("Conplete Success!")



Tell me what number it makes it too!
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
23 Mar 2014 11:53 AM
Sorry that wouldn't work


Lemme try something else

Model = PATHTOMODEL
C = Model:GetChildren()
print("Success 1.")
for I = 1,#C do
C[I].Name = C[I].BrickColor
end
print("Success 2.")
Model = PATHTOMODEL
C = Model:GetChildren()
print("Success 3.")
A = 3
for I = 1,#C do
if Model:FindFirstChild(C[I].Name) then
C[I].Parent = Model[C[I].Name]
A = I + A
print("Success ".. A ..".")
else
M = Instance.new("Model", Model)
M.Name = C[I].Name
C[I].Parent = M
print("Success ".. I + A ..".")
end
end
print("Conplete Success!")



Tell me what number it makes it too!
Report Abuse
sergiu8957 is not online. sergiu8957
Joined: 01 Dec 2008
Total Posts: 607
23 Mar 2014 12:18 PM
I only had Success 1 in output
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
23 Mar 2014 12:31 PM
I found the error, but I have no idea how to fix it. You can set the models name to its color, I suppose that's kind of obvious...
Report Abuse
sergiu8957 is not online. sergiu8957
Joined: 01 Dec 2008
Total Posts: 607
23 Mar 2014 01:02 PM
The issue is that the model has a whole lot of colors, but I'll see what I can do about changing them manually.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
23 Mar 2014 01:47 PM
No, that's not it. I need to turn the BrickColor into a string...
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