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 » Scripters
Home Search
 

Re: simple script

Previous Thread :: Next Thread 
Wednesdaythe13th is not online. Wednesdaythe13th
Joined: 28 Oct 2011
Total Posts: 286
07 Jun 2015 03:28 AM
that turns all of one material of a certain color into another material of another color, in the whole game.

This is to not LITERALLY take weeks manually changing the material and color of everything.. qq


So, can it be done?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Jun 2015 03:30 AM
local a;

a = function(b)
if b:IsA("BasePart") and b.BrickColor.Name == "Old Color" and b.Material.Name == "Old Material" then
b.BrickColor = BrickColor.new("New Color");
b.Material = "New Material";
end
for c, d in next, b:GetChildren() do
a(d);
end
end;

Not the best way, but who cares since you are probably only going to do this once.
Report Abuse
Wednesdaythe13th is not online. Wednesdaythe13th
Joined: 28 Oct 2011
Total Posts: 286
07 Jun 2015 03:48 AM
tyvm
Report Abuse
nickcool9999 is not online. nickcool9999
Joined: 04 Dec 2007
Total Posts: 1528
07 Jun 2015 04:56 AM
You can program a plugin to do the dirty work for you
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
07 Jun 2015 05:57 AM
But then you have to do the dirty work of making the plugin.

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
Report Abuse
Wednesdaythe13th is not online. Wednesdaythe13th
Joined: 28 Oct 2011
Total Posts: 286
07 Jun 2015 06:24 PM
Hm... the script doesn't seem to be working... I placed the coding into the script, adjusted it to change what I needed to change, and nothing happens when I try running the game.

Anything I'm doing wrong, or am forgetting to do?
Report Abuse
Darkenus is not online. Darkenus
Joined: 17 Jul 2014
Total Posts: 1997
07 Jun 2015 06:42 PM
function changeStuff(parent)
for i,v in next, parent:getChildren() do
if child:IsA("BasePart") and child.Material == "Slate" and child.BrickColor.Name == "Really red" then
child.BrickColor = BrickColor.new("Bright red")
child.Material = "Brick"
elseif child:IsA("Model") then
changeStuff(child)
end
end
end

changeStuff(game.Workspace)

________________________________

Change the values to fit your situation.
Report Abuse
Wednesdaythe13th is not online. Wednesdaythe13th
Joined: 28 Oct 2011
Total Posts: 286
07 Jun 2015 06:50 PM
Thanks.

So, do I just put it all in a script, adjust the values, and then run the game, or...?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Jun 2015 06:52 PM
Oh sorry you had to do: a(workspace)
Report Abuse
Darkenus is not online. Darkenus
Joined: 17 Jul 2014
Total Posts: 1997
07 Jun 2015 06:56 PM
Yes. Just run the game.
Report Abuse
Wednesdaythe13th is not online. Wednesdaythe13th
Joined: 28 Oct 2011
Total Posts: 286
07 Jun 2015 06:57 PM
like this?

local a(workspace);

a = function(b)
if b:IsA("BasePart") and b.BrickColor.Name == "Really black" and b.Material.Name == "Plastic" then
b.BrickColor = BrickColor.new("Dark stone grey");
b.Material = "Cobblestone";
end
for c, d in next, b:GetChildren() do
a(d);
end
end;
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Jun 2015 07:00 PM
No, just a(workspace); at the BOTTOM


a = function(b)
if b:IsA("BasePart") and b ~= workspace.Terrain and b.BrickColor.Name == "Really black" and b.Material.Name == "Plastic" then
b.BrickColor = BrickColor.new("Dark stone grey");
b.Material = "Cobblestone";
end
for c, d in next, b:GetChildren() do
a(d);
end
end;

a(workspace);
Report Abuse
Darkenus is not online. Darkenus
Joined: 17 Jul 2014
Total Posts: 1997
07 Jun 2015 07:01 PM
Yes. However, if you are changing EVERYTHING, as in, you want to look through a model's parts to find it's parts, I suggest you use mine, as it loops through the models too.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Jun 2015 07:06 PM
Mine loops through everything, models included too.
Report Abuse
Wednesdaythe13th is not online. Wednesdaythe13th
Joined: 28 Oct 2011
Total Posts: 286
07 Jun 2015 07:07 PM
IT WOOOOORRKKKEED< YYEESSSSSSSS



TY BOTH SO MUCH.

My first two children will be named after your usernames.
Report Abuse
Darkenus is not online. Darkenus
Joined: 17 Jul 2014
Total Posts: 1997
07 Jun 2015 07:08 PM
Oh yes, it does. I read it wrong :/
Report Abuse
Darkenus is not online. Darkenus
Joined: 17 Jul 2014
Total Posts: 1997
07 Jun 2015 07:08 PM
xD Okay. Happy to help.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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