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: Same type

Previous Thread :: Next Thread 
kaleighallyas123 is not online. kaleighallyas123
Joined: 22 Jan 2013
Total Posts: 890
07 Jan 2016 02:38 PM
Okay, I have 0 Scripting experience at all, but I need someone to make a script that I can just copy into a script in studio. Basically, the script needs to turn all cylinders in my game red. It would make things so much easier for me.
Report Abuse
kaleighallyas123 is not online. kaleighallyas123
Joined: 22 Jan 2013
Total Posts: 890
07 Jan 2016 02:42 PM
Bump please
Report Abuse
mudkip99 is not online. mudkip99
Joined: 17 Jun 2008
Total Posts: 3362
07 Jan 2016 02:50 PM
local objects = script.Parent:GetChildren() -- Get all objects

for i, v in ipairs(objects) do

if(objects[i]:IsA("Part") and objects[i].Shape == Enum.PartType.Cylinder) then
objects[i].BrickColor = BrickColor.new("Bright red")
end
end


Note, this will only change the color of cylinders that are directly in the workspace (or whatever the parent of the script is). If you want to run this in a model, you have to put the script directly in the model. It could be modified to get all parts in the workspace.
Report Abuse
kaleighallyas123 is not online. kaleighallyas123
Joined: 22 Jan 2013
Total Posts: 890
07 Jan 2016 03:00 PM
Thank you, but like I said, I have 0 scripting experience. The cylinders are directly in the workspace, so do I put this in the command bar, script, local script, or module script? Sorry, like I said, never opened up studio for more than like 30 seconds ever.
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
07 Jan 2016 03:13 PM
It would be a script in the workspace or serverscriptservice.



Report Abuse
Bakers is not online. Bakers
Joined: 27 Sep 2010
Total Posts: 182
07 Jan 2016 03:27 PM
function changeColor(Model)
for _,Part in pairs(Model:GetChildren()) do
if Part.ClassName == "Part" and Part.Shape == Enum.PartType.Cylinder then
Part.BrickColor = BrickColor.new("Bright red")
end
changeColor(Part)
end
end

changeColor(workspace)

put in commandbar
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