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
 

Re: 'name' a nil value

Previous Thread :: Next Thread 
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
09 Feb 2013 07:23 PM
if hit.Name:match("%d+") and hit.Name:match("tree")then
print("chop")
local a = tonumber(hit.Name:match("%d+"))
local b = a + 1
hit.Name = b.." tree"
print(hit.Name, a)
hit.Size = Vector3.name(hit.Size.x - a*0.05,hit.Size.y,hit.Size.z - a*0.05)--error line
end

for some reason i'm getting this error: attempt to call field 'name' (a nil value)
however print(hit.Name, a) results in: 1 tree 1
which is exactly what it should print... any ideas why?

oh and 'hit' is what is returned by the touched event, this is just part of the script.
Report Abuse
MrBlu3 is not online. MrBlu3
Joined: 26 May 2012
Total Posts: 37
09 Feb 2013 07:39 PM
Vector3 has a 'name' property?
Report Abuse
Legoman654 is not online. Legoman654
Joined: 05 Jun 2008
Total Posts: 534
09 Feb 2013 07:39 PM
Name should be the person making contact. Try: hit.Parent
Report Abuse
Legoman654 is not online. Legoman654
Joined: 05 Jun 2008
Total Posts: 534
09 Feb 2013 07:40 PM
EDIT:

Actually scratch my say. I honestly have no idea what Name is being addressed as.
Report Abuse
ashispro is not online. ashispro
Joined: 14 Sep 2008
Total Posts: 452
09 Feb 2013 07:45 PM
I think you mean 'new' not 'name'
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
09 Feb 2013 07:47 PM
hit.Size = Vector3.name(hit.Size.x - a*0.05,hit.Size.y,hit.Size.z - a*0.05)

You put Vector3.name...
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
09 Feb 2013 08:20 PM
I feel stupid for not noticing that, totally derped... thanks for pointing that out XD
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