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
 

Touched event not working, nil value

Previous Thread :: Next Thread 
MrRoboman4321 is not online. MrRoboman4321
Joined: 08 Apr 2012
Total Posts: 18
22 Jan 2013 08:50 PM
Hello. My touched script isn't working.
Output: Attempt to call a nil value

Script:

function touched(object)
print("Touched")
end
script.Parent.Touched:connect(touched())

I just put an un-anchored part above the part this script is attached to, the first few times it worked, now it doesn't. Why?
Report Abuse
EyeballWarrior4321 is not online. EyeballWarrior4321
Joined: 26 Dec 2012
Total Posts: 595
22 Jan 2013 08:52 PM
In connect(), you don't put the brackets of the function in it.
i.e. script.Parent.Touched:connect(touched)
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
22 Jan 2013 09:09 PM
@eye anonymous functions are;

script.Parent.Touched:connect(function(touched)
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
22 Jan 2013 09:12 PM
@Azarth

Then, he would need a closed parenthesis in the end...

@op

The basic idea of anonymous functions is this:

[Object].[Event]:connect(function (argument)

--Code

end)

There is no need to name the function because it already is self defined.


~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ 【▬】
Report Abuse
EyeballWarrior4321 is not online. EyeballWarrior4321
Joined: 26 Dec 2012
Total Posts: 595
22 Jan 2013 09:29 PM
Op?
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
22 Jan 2013 09:32 PM
Op = Original Poster -- Person who created this thread.

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ 【▬】
Report Abuse
MrRoboman4321 is not online. MrRoboman4321
Joined: 08 Apr 2012
Total Posts: 18
22 Jan 2013 09:42 PM
@Eye yours worked

@Azrath I didn't want it to be anonymous...
Report Abuse
EyeballWarrior4321 is not online. EyeballWarrior4321
Joined: 26 Dec 2012
Total Posts: 595
23 Jan 2013 04:44 PM
:D
Report Abuse
EyeballWarrior4321 is not online. EyeballWarrior4321
Joined: 26 Dec 2012
Total Posts: 595
23 Jan 2013 04:44 PM
I have this wierd feeling, like I helped somebody..oh wait, I did. :DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
23 Jan 2013 05:28 PM
@Jonah

That wasn't the best explanation of an anonymous function(even if it was a basic explanation)

(function(arg)
print(arg)
end)("hi")
Report Abuse
MrRoboman4321 is not online. MrRoboman4321
Joined: 08 Apr 2012
Total Posts: 18
27 Jan 2013 01:54 PM
I know how anonymous functions work guys.
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