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
 

Colour Changing Script

Previous Thread :: Next Thread 
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
29 Jul 2012 04:33 PM
I want to make a script that changes any part that is Magenta to Bright red, so I don't have to do it all manually. Would anybody be able to help me with this?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
29 Jul 2012 04:35 PM
function color(location, color1, color2)
for i, v in pairs(location:GetChildren()) do
if v:IsA("BasePart") and v.BrickColor == BrickColor.new(color1) then
v.BrickColor = BrickColor.new(color2)
end
end
end

color(Workspace, "Magenta", Bright red")

† KMXD † - Evil Duck Overlord, bent on world domination.
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
29 Jul 2012 04:36 PM
Thank you very much. Do I put that into the model with the magenta parts, and then just click play?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
29 Jul 2012 04:36 PM
function color(location, color1, color2)
for i, v in pairs(location:GetChildren()) do
if v:IsA("BasePart") and v.BrickColor == BrickColor.new(color1) then
v.BrickColor = BrickColor.new(color2)
end
end
end
color(Workspace, "Magenta", "Bright red")

† KMXD † - Evil Duck Overlord, bent on world domination.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
29 Jul 2012 04:37 PM
No, just change "Workspace" to the location of the magenta parts, you can put the script in Workspace.

† KMXD † - Evil Duck Overlord, bent on world domination.
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
29 Jul 2012 04:40 PM
It didn't work, but thank you for trying anyway :)
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
29 Jul 2012 04:41 PM
Did you try the second one? And what was the new location?

† KMXD † - Evil Duck Overlord, bent on world domination.
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
29 Jul 2012 04:43 PM
I tried the second one. The new location was RaidStorm1.
Report Abuse
bourlo is not online. bourlo
Joined: 11 Aug 2009
Total Posts: 399
29 Jul 2012 04:44 PM
you need to use the full name game.Workspace.RaidStorm1 or something
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
29 Jul 2012 04:51 PM
Do I need to change 'location' to 'RaidStorm1' as well as changing 'Workspace' to 'RaidStorm1'? Or do I change 'Workspace' to 'game.Workspace.RaidStorm1'? Sorry, I'm really confused.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
29 Jul 2012 04:52 PM
No, as Bourlo stated, you need tell it where it is.

function color(location, color1, color2)
for i, v in pairs(location:GetChildren()) do
if v:IsA("BasePart") and v.BrickColor == BrickColor.new(color1) then
v.BrickColor = BrickColor.new(color2)
end
end
end
color(Workspace.RaidStorm1, "Magenta", "Bright red") --It is in Workspace right?

† KMXD † - Evil Duck Overlord, bent on world domination.
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
29 Jul 2012 04:54 PM
Ok, and where it says 'location', do I change that too, or does that stay the same?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
29 Jul 2012 04:55 PM
No, don't change it.

† KMXD † - Evil Duck Overlord, bent on world domination.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
29 Jul 2012 04:56 PM
I should have just stated, the bottom line is all you had to edit, the rest was the function I made to do everything.

† KMXD † - Evil Duck Overlord, bent on world domination.
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
29 Jul 2012 04:57 PM
Thanks, you just saved me hours of work :3
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
29 Jul 2012 05:03 PM
No problem. :P

† KMXD † - Evil Duck Overlord, bent on world domination.
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
29 Jul 2012 06:03 PM
If I want to change something in Lighting, do I just replace Workspace with Lighting?
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