|
| 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 |
|
|
| |
|
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 |
|
|
|
| 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 |
|
|
|
| 07 Jan 2016 03:13 PM |
It would be a script in the workspace or serverscriptservice.
|
|
|
| Report Abuse |
|
|
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 |
|
|