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

Previous Thread :: Next Thread 
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
26 Jun 2016 10:14 PM
It works how I wanted it to work BUT I want it so the wheels and what not, do not get colored and so they remain black. Any idea on how to make certain parts of the vehicle remain their original color?

model = workspace.Jeep
bin = script.Parent

function onTouched(part)
if (model.Name == "Jeep") then
for index, part in pairs(model:GetChildren()) do
part.BrickColor = script.Parent.BrickColor
end
end
end
connection = bin.Touched:connect(onTouched)
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
26 Jun 2016 10:15 PM
b1
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
26 Jun 2016 10:16 PM
b2
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
26 Jun 2016 10:18 PM
b3
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
26 Jun 2016 10:18 PM
If you're not using meshes, just include a check in each iteration in the for loop to see if the part is a Cylinder or not.

if not (part.Shape == Enum.Shape.Cylinder) then
-- code here
end
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
26 Jun 2016 10:21 PM
I want it so all parts that are NOT named "Block" will not get colored.
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
26 Jun 2016 10:22 PM
Not sure how to do that... Also i'm not using any mesh
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
26 Jun 2016 10:26 PM
I want all the parts in "Jeep" that are called "Block" to get colored.. This is what I have so far, and it's not working.

model = workspace.Jeep.Block
bin = script.Parent

function onTouched(part)
if (model.Name == "Block") then
for index, part in pairs(model:GetChildren()) do
part.BrickColor = script.Parent.BrickColor
end
end
end
connection = bin.Touched:connect(onTouched)
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
26 Jun 2016 10:32 PM
bump......
Report Abuse
TheeDeathCaster is not online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
26 Jun 2016 10:37 PM
@Mezur You were close; you should've put the 'if' inside the for loop. Here's an example code below:

for i, v in pairs(ASSET) do
if v.Name == 'Block' and v:IsA('BasePart') then -- What if there was an asset that wasn't a Part in the model, and is named 'Block' too?
v.BrickColor = BrickColor.new('Really red')
end
end


Thanks for reading, and have a nice day. :)
Report Abuse
Qraotic is online. Qraotic
Joined: 12 Mar 2016
Total Posts: 63
26 Jun 2016 10:38 PM
check if the name is "Block" in the pairs loop

for _,part in pairs(model) do
if part.Name=="Block" then
part.BrickColor=BrickColor.Black()
end
end
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
26 Jun 2016 10:39 PM
i figured it out. my problem was actually pretty simple lol.
Report Abuse
Crimsonal is not online. Crimsonal
Joined: 23 Apr 2011
Total Posts: 1795
26 Jun 2016 10:43 PM
Idk what you're trying to do here and I see you've been having this problem for awhile now, But try this:


script.Parent.Touched:connect(function(part)
if part.Parent.Name == "Jeep" then
for i,v in pairs(part.Parent:GetChildren()) do
if v.Name == "Block" then
v.BrickColor = script.Parent.BrickColor
end
end
end
end)
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