wentman
|
  |
| Joined: 13 Aug 2013 |
| Total Posts: 130 |
|
|
| 05 Aug 2017 01:58 PM |
I tried this: for _,v in pairs (workspace.Car:GetChildren()) do v.CFrame = v.CFrame + Vector3.new(0,0,5) print(v.Position)
and then the output says: 11:58:30.589 - CFrame is not a valid member of Script 11:58:30.590 - Stack Begin 11:58:30.590 - Script 'Workspace.Car.Script', Line 18 11:58:30.591 - Stack End |
|
|
| Report Abuse |
|
|
wentman
|
  |
| Joined: 13 Aug 2013 |
| Total Posts: 130 |
|
| |
|
wentman
|
  |
| Joined: 13 Aug 2013 |
| Total Posts: 130 |
|
| |
|
HeIix
|
  |
| Joined: 19 Jan 2013 |
| Total Posts: 253 |
|
|
| 05 Aug 2017 02:04 PM |
for _,v in pairs (workspace.Car:GetChildren()) do if v.Name ~= "Script" then v.CFrame = v.CFrame + Vector3.new(0,0,5) end print(v.Position)
it's trying to access the CFrame of the script inside the car
|
|
|
| Report Abuse |
|
|
|
| 05 Aug 2017 02:05 PM |
"for _,v in pairs (workspace.Car:GetChildren()) do v.CFrame = v.CFrame + Vector3.new(0,0,5) print(v.Position) "
after the iteration, check to see if "v" is a BasePart so that it doesn't confuse the loop.
Should look like this:
for _,v in pairs (workspace.Car:GetChildren()) do if v:IsA"BasePart" then v.CFrame = v.CFrame + Vector3.new(0,0,5) print(v.Position) end |
|
|
| Report Abuse |
|
|
wentman
|
  |
| Joined: 13 Aug 2013 |
| Total Posts: 130 |
|
| |
|
|
| 05 Aug 2017 02:06 PM |
| @Helix, that only checks for Names. There could be a part named "Script" for all we know |
|
|
| Report Abuse |
|
|
wentman
|
  |
| Joined: 13 Aug 2013 |
| Total Posts: 130 |
|
|
| 05 Aug 2017 02:06 PM |
| Thanks! I didn't notice I put my script inside the car XD. |
|
|
| Report Abuse |
|
|