Virtucon
|
  |
| Joined: 05 Apr 2012 |
| Total Posts: 2896 |
|
|
| 24 Aug 2014 05:54 PM |
Car = game.Workspace[script.Parent.Parent.Parent.Parent.Parent.Name.."Car"]
for i = 1,#Car do <------- this is what output said was a userdata value Parts = Car[i]:GetChildren()
-------------------[Below is just a example of a function in the script, no errors here]--------------------------
function A()
for i = 1,#Parts do if Parts[i].Name == ("CPart") then Parts[i].BrickColor = BrickColor.new('Alder') end end end
script.Parent.PaintGUI.Alder.MouseButton1Down:connect(A)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Output:
Players.Virtucon.PlayerGui.ControlGUI.CarPanel.PMPanel.CarC:9: attempt to get length of global 'Car' (a userdata value)
|
|
|
| Report Abuse |
|
Saldor010
|
  |
| Joined: 20 Sep 2010 |
| Total Posts: 1035 |
|
|
| 24 Aug 2014 09:23 PM |
Are you trying to get the number of children inside "Car"? If so, you need to do this.
for i=1,#Car:GetChildren() do
...
end
Because right now, you're trying to get the length of a model or something else that does not have a length. That's why it is giving you that error. |
|
|
| Report Abuse |
|