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 » Scripting Helpers
Home Search
 

Userdata value error

Previous Thread :: Next Thread 
Virtucon is not online. 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 is online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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