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: "10:attempt to index field 'Target' (a nil value)"

Previous Thread :: Next Thread 
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
04 May 2013 08:27 PM
Or so the output says.

Line ten:

if Mouse.Target.Name == PickupableItems[i] then

Line that defines Target (Mouse, rather):

local Mouse = game.Players.LocalPlayer:GetMouse()

Am I missing something?
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
04 May 2013 08:28 PM
if (Mouse.Target) and (Mouse.Target.Name == PickupableItems[i]) then
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
04 May 2013 08:32 PM
Yo, lose the brackets
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
04 May 2013 08:34 PM
Ah, thanks. Can you explain why this doesn't work? It doesn't give output, and doesn't print what I want it to print either:


function KeyPressed(key)
if key == "t" then
print ("t lololol")
for i = 1,#PickupableItems do
if Mouse.Target.Name == PickupableItems[i] then
Mouse.target:Remove()
end
end
end
end
Mouse.KeyDown:connect(KeyPressed)

Note that this is not the full code, but just a snippet of it. It is in a hopperbin, and is part of the upper code I posted earlier.
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
04 May 2013 08:35 PM
You haven't implemented Cody's suggestion, that's why it doesn't work.
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
04 May 2013 08:38 PM
Yes I did?? That's why I said thanks..
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
04 May 2013 08:53 PM
Bump.
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
04 May 2013 08:57 PM
"Mouse.Target and Mouse.Target.Name == PickupableItems[i]" appears nowhere in your code.
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
04 May 2013 09:04 PM
"Note that this is not the full code, but just a snippet of it. It is in a hopperbin, and is part of the upper code I posted earlier."
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
04 May 2013 09:09 PM
If you want to be snappy with me, I'll stop helping you. The fact that you're not willing to put the fix in the code means that you can't fix it.
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
04 May 2013 09:12 PM
You're not really wanting to help, are you? I already told you that I implemented the code fix earlier. This is a later part of the code. My first problem is solved. Now I'm asking for help for the second fix. I shall post the full code if you want it, but I have made the fix Cody provided. This is the same script, just later on. If you really need proof, I'll give you it. I'm not trying to be snappy; you're just not reading what I'm posting..
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
04 May 2013 09:30 PM
Bump.
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
04 May 2013 10:14 PM
Bump..
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
05 May 2013 11:50 AM
Bum...
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
05 May 2013 03:22 PM
Bump....
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
05 May 2013 08:55 PM
Bump.....
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
05 May 2013 09:17 PM
._.
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
05 May 2013 09:42 PM
Anyone??
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
06 May 2013 10:17 AM
Bump.
Report Abuse
Zkiller11 is not online. Zkiller11
Joined: 25 Aug 2009
Total Posts: 2914
06 May 2013 11:10 AM
Bump..
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
06 May 2013 11:19 AM
Before referencing target add,
if not mouse.Target then return end
The issue is that you are not always moused over an object.
Report Abuse
CustardCream95 is not online. CustardCream95
Joined: 16 Aug 2012
Total Posts: 579
06 May 2013 11:35 AM
The Keydown/press should look like:

Key = key:lower()
if key == "LETTERPRESSEDINLOWERCASE" then

NOTE: THIS IS WITHOUT THE HOPPERBIN
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
06 May 2013 11:39 AM
It also doesn't help that Target is in the wrong case on the line to remove it. Target is Target not target.
Report Abuse
CustardCream95 is not online. CustardCream95
Joined: 16 Aug 2012
Total Posts: 579
06 May 2013 11:40 AM
Zkiller I hope you know we rarely use hopperbin's now.
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
06 May 2013 11:48 AM
@Custard - That's not true. I happen to use them alot.
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