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: How do I repaint multiple car parts at once?

Previous Thread :: Next Thread 
Epiczombiekiller1998 is not online. Epiczombiekiller1998
Joined: 07 Aug 2011
Total Posts: 4918
27 Jul 2015 11:17 AM
I already renamed all the recolorable car parts to V and my current method is that each V has this script in them.

while wait (1) do
script.Parent.BrickColor = script.Parent.Parent.Vealik.BrickColor
end

The method is that all the V named parts have this script in them which turns them into the color of the brick named Vealik, but the problem is that this method is filled with loops and causes lag because there are about atleast 20 recolorable parts in the car and there are a lot of cars in the game.
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
27 Jul 2015 11:21 AM
One script in the car.
I am assuming this:

-Workspace

--Car MODEL
---V
---Script
---V
---Part
---V


local Vealik = WHEREVER VEALIK IS.

Vealik.Changed:connect(function()
for i, v in next, script.Parent:GetChildren() do
if v.Name == "V" and v:IsA("BasePart") then
v.BrickColor = Vealik.BrickColor;
end
end
end)

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
Report Abuse
ByDefault is not online. ByDefault
Joined: 25 Jul 2014
Total Posts: 3197
27 Jul 2015 11:21 AM
for i,v in pairs(CarModel:GetChildren()) do
v.BrickColor = BrickColor.new("White")
end
Report Abuse
notfruit is not online. notfruit
Joined: 21 Sep 2012
Total Posts: 1386
27 Jul 2015 11:25 AM
Don't use a loop nub, make one script and do this:

parts = something.something:getChildren() -- use this probably to get parts

use script.Parent.Vealik.Changed:connect(function(property)
-- if property is BrickColor, change color of all parts in the table "parts"
end)

Here:
http://wiki.roblox.com/index.php?title=API:Class/Instance/Changed
Report Abuse
BobserLuck is not online. BobserLuck
Joined: 09 Mar 2012
Total Posts: 653
27 Jul 2015 11:25 AM
Sorry but you have just made a major mistake, having that many parts that change collor and each with their own script will cause major lag. Instead, use a for loop:
while wait(1) do
for i, v in pairs (script.Parent:GetChildren()) do
if v.Name=="V" then
v.BrickColor=game.Workspace.Vealik.BrickColor
end
end
end

Put this in each car, this will help allot with the lag than just having a script for every part.
Report Abuse
BobserLuck is not online. BobserLuck
Joined: 09 Mar 2012
Total Posts: 653
27 Jul 2015 11:26 AM
I too slow.. :(
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