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: Need help

Previous Thread :: Next Thread 
TrafficHazard is not online. TrafficHazard
Joined: 27 May 2010
Total Posts: 411
04 Jul 2016 03:24 PM
Is there anyway to make all the parts in the game the same color all at once?
Report Abuse
TrafficHazard is not online. TrafficHazard
Joined: 27 May 2010
Total Posts: 411
04 Jul 2016 03:25 PM
with a script i mean, like, click a button and it all changes
Report Abuse
xXLegendarySoldierXx is not online. xXLegendarySoldierXx
Joined: 22 Mar 2012
Total Posts: 551
05 Jul 2016 05:32 AM
So, if you are talking about a Gui button then this is how it would go:

local parts = game.Workspace:GetChildren()

for i, v in pairs(parts) do
if v:IsA("Part") then
v.BrickColor = BrickColor.new("Really red")
end
end

That should change them. Also, if you have a specific name for the parts like, ChangeColor then you could change if v:IsA("Part") then to if v.Name == "ChangeColor"

But I hope this helped, or at least pointed you in the right direction!
Report Abuse
xXLegendarySoldierXx is not online. xXLegendarySoldierXx
Joined: 22 Mar 2012
Total Posts: 551
05 Jul 2016 05:33 AM
Fixed code:

script.Parent.MouseButton1Click:connect(function()
local parts = game.Workspace:GetChildren()

for i, v in pairs(parts) do
if v:IsA("Part") then
v.BrickColor = BrickColor.new("Really red")
end
end
end)

I forgot to make it a function, also if it is a gui button then make sure this is in a LocalScript
Report Abuse
kangerujack is not online. kangerujack
Joined: 08 Nov 2009
Total Posts: 690
05 Jul 2016 05:36 AM
If you're talking about a brick with a Click Detector:

This will also check models for parts too in case you have models with parts

script.Parent.ClickDetector.MouseClick:connect(function()
for _, v in pairs (workspace:getChildren()) do
if v:IsA("Part") then
v.BrickColor = BrickColor.new("Black")
elseif v:IsA("Model") then
for _, x in pairs (v:getChildren()) do
if x:IsA("Part") then
x.BrickColor = BrickColor.new("Black")
end
end
end
end)
Report Abuse
kangerujack is not online. kangerujack
Joined: 08 Nov 2009
Total Posts: 690
05 Jul 2016 05:40 AM
Actually forget that last script, why have it only search layer 1 models? What if you have models inside of models because you're organized?


Color = "Black"

function findParts(location)
for _, v in pairs(location:getChildren()) do
if v:IsA("Part") then
v.BrickColor = BrickColor.new(Color)
elseif v:IsA("Model") then
findParts(v)
end
end
end

findParts(workspace)

script.Parent.ClickDetector.MouseClick:connect(function()
findParts(workspace)
end)
Report Abuse
xXLegendarySoldierXx is not online. xXLegendarySoldierXx
Joined: 22 Mar 2012
Total Posts: 551
05 Jul 2016 06:02 AM
Lol, I didn't do the click detector one because I didn't know it was basically the same. I never use ClickDetectors.
Report Abuse
kangerujack is not online. kangerujack
Joined: 08 Nov 2009
Total Posts: 690
05 Jul 2016 06:04 AM
The only reason I know of Click Detectors is because GUIs were too intense for me in 2010.
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