I don't know if this will completely work, I think it will.
01 | script.Parent.Parent.Name = "CarRegen" |
04 | local children = game.ServerStorage:children() |
06 | local ChangeColor = true |
07 | local NameOfPartsToColor = "ChangeColor" |
10 | if (children [ i ] .Name = = "Car" ) then |
11 | table.insert(everything, children [ i ] :clone()) |
12 | table.insert(names, children [ i ] .Name) |
16 | function unanchor(Model) |
17 | local ThingsToUnanchor = Model:GetChildren() |
18 | for i = 1 , #ThingsToUnanchor do |
19 | if (ThingsToUnanchor [ i ] :IsA( "Part" )) then |
20 | ThingsToUnanchor [ i ] .Anchored = false |
21 | elseif (ThingsToUnanchor [ i ] :IsA( "Model" )) then |
22 | local TTU = ThingsToUnanchor [ i ] :GetChildren() |
24 | if (TTU [ i ] :IsA( "Part" )) then |
25 | TTU [ i ] .Anchored = false |
32 | function ColorCar(Model) |
34 | local ThingsToColor = Model:GetChildren() |
35 | local Color = BrickColor.random() |
36 | for i = 1 , #ThingsToColor do |
37 | if (ThingsToColor [ i ] .Name = = NameOfPartsToColor) then |
38 | ThingsToColor [ i ] .BrickColor = Color |
45 | for i = 1 ,#everything do |
46 | local new_thing = everything [ i ] :clone() |
47 | new_thing.Parent = game.Workspace.CarRegen |
48 | new_thing:makeJoints() |
54 | script.Parent.ClickDetector.MouseClick:connect( function () |