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: How can an object not have a parent?

Previous Thread :: Next Thread 
thewhiteshark is not online. thewhiteshark
Joined: 14 Jun 2012
Total Posts: 212
17 Aug 2013 05:09 AM
Workspace.Model.Script:5: attempt to index field 'Parent' (a nil value)
Line Five: if hit.Parent:FindFirstChild("Humanoid") ~= nil then
Report Abuse
MainDirectory is not online. MainDirectory
Joined: 20 Dec 2012
Total Posts: 1834
17 Aug 2013 05:10 AM
It means its non-existent. Meaning you are tagging it wrong.
Report Abuse
thewhiteshark is not online. thewhiteshark
Joined: 14 Jun 2012
Total Posts: 212
17 Aug 2013 05:12 AM
I am not tagging it wrong, It works 90% of the time. I connected .Touched to a function touched(hit)...
Report Abuse
thewhiteshark is not online. thewhiteshark
Joined: 14 Jun 2012
Total Posts: 212
17 Aug 2013 05:13 AM
In order for it to run that script and get the error the part would have to be hit by something and that something must have a parent.
Report Abuse
Cakins is not online. Cakins
Joined: 23 Jul 2009
Total Posts: 307
17 Aug 2013 05:15 AM
Here is a plausible scenario.

Object 1 hits object 2.
Object 2 or the parent of object 2 is removed.
Script checks for parent of object 2.
Report Abuse
MainDirectory is not online. MainDirectory
Joined: 20 Dec 2012
Total Posts: 1834
17 Aug 2013 05:17 AM
Oh no cakins, thats impossible bruh, could never happen, parent is so not non0existent bruh, could nevrr be true bruh, imosibruuu!!!
Report Abuse
Cakins is not online. Cakins
Joined: 23 Jul 2009
Total Posts: 307
17 Aug 2013 05:20 AM
U rite. Mah bad. Disregurd. /cry
Report Abuse
MainDirectory is not online. MainDirectory
Joined: 20 Dec 2012
Total Posts: 1834
17 Aug 2013 05:21 AM
Its k, youlllllll LEARN. br0
Report Abuse
iluvzombies7 is not online. iluvzombies7
Joined: 29 Aug 2011
Total Posts: 1635
17 Aug 2013 06:58 AM
game doesn't have a parent. Check out this basic script. game. Workspace.RandomBrick.Transparency = 1. Is there anything before game? No.
Report Abuse
08C is not online. 08C
Joined: 26 Jan 2013
Total Posts: 847
17 Aug 2013 07:10 AM
[ Content Deleted ]
Report Abuse
BJCarpenter is online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
17 Aug 2013 09:38 AM
You are going to have to ask what u hit, before "Up Valuing" hits Parent, because Sky doesn't have a Parent (Or some other Part u hit all the time with mouse....)?

Check what Target equals as well, Print-out all of the possible senerios, then take appropriate actions....
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
17 Aug 2013 09:43 AM
You should not use pcall in this case, because you do not need to use pcall. The only place to use pcall in Roblox is when writing a script builder script or any form of server communication (marketplaceservice, teleportservice, data persistence, etc).

@OP
When trying to get help, please post the entire script.
My guess is you did not check to see if hit.Parent ~= nil in your script.
Report Abuse
BJCarpenter is online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
17 Aug 2013 09:57 AM
Only problem is that this will give him the same error:

if hit.Parent ~= nil in your script

You r going to have to ask a few questions about hit, first.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
17 Aug 2013 09:58 AM
That won't give him an error. o_O
Report Abuse
BJCarpenter is online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
17 Aug 2013 10:06 AM
Yeah,

I see that laser gun does the same thing:

local humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid")

I had no idea. Makes things a lot easier.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
17 Aug 2013 10:14 AM
"hit and "

That part isn't even needed because 'hit' will always exist in a touched script where the parameter is named 'hit'.
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