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: Attempt to call a nil value?

Previous Thread :: Next Thread 
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
01 Feb 2014 10:02 PM
Ok I made a new thread because I ran into a new problem. -.-


function show(val)
local stuff=game.workspace:GetChildren()
for i=1,#stuff do
if stuff[i].Name=="Door" then
if stuff[i].Number.Value==val then
stuff[i].Door.Transparency=1
wait(5)
stuff[i].Door.Transparency=0
end
end
end
end

for i=1, #stuff do
if stuff[i].Name=="Door" then
stuff[i].Door.ClickDetector.MouseClick:connect(show(stuff[i].Number.Value))
end
end




---the only error is attempt to call a nil value; disconnected because of exception. What!? I think I set it up right D:
Report Abuse
fireheart568 is not online. fireheart568
Joined: 04 Jan 2009
Total Posts: 1285
01 Feb 2014 10:06 PM
In your for loop. Where did you define 'stuff'? I mean the part where it says 'for i=1, #stuff do'
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
01 Feb 2014 10:07 PM
:GetChildren() is there, i just didn't put it in this post
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
01 Feb 2014 10:08 PM
i mean stuff=game.workspace:GetChildren()

is already there i forgot to post it in the thread.
Report Abuse
shawnyg is not online. shawnyg
Joined: 21 Apr 2011
Total Posts: 1428
01 Feb 2014 10:09 PM
@Fire, 2nd line..

~Hope I helped! If you need a script, PM me.~ ~The G~ ~CAT General Shawnyg~
Report Abuse
jonesj627 is not online. jonesj627
Joined: 06 Oct 2010
Total Posts: 1496
01 Feb 2014 10:15 PM
function show(val)
what the heck is val?!!
make val into a variable
val = 0
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
01 Feb 2014 10:19 PM
val is the number value from each of stuff
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
01 Feb 2014 10:33 PM
any1?
Report Abuse
david1234501 is not online. david1234501
Joined: 04 Oct 2008
Total Posts: 737
01 Feb 2014 11:10 PM
You defined stuff as local, so outside of the first function is is considered nil. Try doing just 'stuff = Workspace:GetChildren()'
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