zub74
|
  |
| Joined: 13 Sep 2008 |
| Total Posts: 489 |
|
|
| 11 Jun 2014 10:47 PM |
for i,v in pairs(Workspace.Car:GetChildren()) do if v.Name=Handle then return else v.Name = "Part" end
I don't have a whole lot of experience with the in pairs thing, but is anything wrong with this script? The purpose would be to rename all children of the model Car Part, unless the name was Handle. |
|
|
| Report Abuse |
|
|
|
| 11 Jun 2014 10:49 PM |
if v.Name=Handle then should be if v.Name == "Handle" then
You use == to compare two things, and Handle is a string, so it needs quotes around it
-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::] |
|
|
| Report Abuse |
|
|
|
| 11 Jun 2014 10:50 PM |
No, first of all because using the = operator is setting the value, using the == is comparing the two to see if they are equal. Plus return would stop the loop. Also the name handle is a string.
for i,v in pairs(Workspace.Car:GetChildren()) do if v.Name ~= "Handle" then -- ~= returns true if they are not equal v.Name = "CarPart" -- you said you wanted the name to be car part right? end end |
|
|
| Report Abuse |
|
|