twitchio
|
  |
| Joined: 13 Aug 2010 |
| Total Posts: 49 |
|
|
| 12 Jan 2013 06:46 PM |
I have this script but it keeps telling me "attempt to index field 'Parent' (a nil Value) Im not sure whats wrong but i pointed out the Parent it is talking about so could someone please help?
-------------------------------------------------- B1 = script.Parent.Parent.Box1 B2 = script.Parent.Parent.Box2 B3 = script.Parent.Parent.Box3 B4 = script.Parent.Parent.Box4 B5 = script.Parent.Parent.Box5 B6 = script.Parent.Parent.Box6 B7 = script.Parent.Parent.Box7 B8 = script.Parent.Parent.Box8 B9 = script.Parent.Parent.Box9 B10 = script.Parent.Parent.Box10 B11 = script.Parent.Parent.Box11 B12 = script.Parent.Parent.Box12
function onTouched(Part) if Part.Name == "Wing1" or "Wing2" then Part.Parent:remove() -- Parent is on this line game.Workspace.Button1.Script.Disabled = false game.Workspace.Button2.Script.Disabled = false game.Workspace.Button3.Script.Disabled = false game.Workspace.Button4.Script.Disabled = false game.Workspace.Button5.Script.Disabled = false end if B1.Transparency == 1 then B1.Transparency = 0 B1.CanCollide = true elseif B2.Transparency == 1 then B2.Transparency = 0 B2.CanCollide = true elseif B3.Transparency == 1 then B3.Transparency = 0 B3.CanCollide = true elseif B4.Transparency == 1 then B4.Transparency = 0 B4.CanCollide = true elseif B5.Transparency == 1 then B5.Transparency = 0 B5.CanCollide = true elseif B6.Transparency == 1 then B6.Transparency = 0 B6.CanCollide = true elseif B7.Transparency == 1 then B7.Transparency = 0 B7.CanCollide = true elseif B8.Transparency == 1 then B8.Transparency = 0 B8.CanCollide = true elseif B9.Transparency == 1 then B9.Transparency = 0 B9.CanCollide = true elseif B10.Transparency == 1 then B10.Transparency = 0 B10.CanCollide = true elseif B11.Transparency == 1 then B11.Transparency = 0 B11.CanCollide = true elseif B12.Transparency == 1 then B12.Transparency = 0 B12.CanCollide = true end end
if B12.Transparency == 0 then script.Parent.Parent.NewTruck.Disabled = false end
script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 06:59 PM |
What line is it erroring on?
|
|
|
| Report Abuse |
|
|
twitchio
|
  |
| Joined: 13 Aug 2010 |
| Total Posts: 49 |
|
|
| 12 Jan 2013 07:04 PM |
Its at line 16 I put thiis at the end of it --Parent is on this line |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 07:11 PM |
B1 = script.Parent.Parent.Box1 B2 = script.Parent.Parent.Box2 B3 = script.Parent.Parent.Box3 B4 = script.Parent.Parent.Box4 B5 = script.Parent.Parent.Box5 B6 = script.Parent.Parent.Box6 B7 = script.Parent.Parent.Box7 B8 = script.Parent.Parent.Box8 B9 = script.Parent.Parent.Box9 B10 = script.Parent.Parent.Box10 B11 = script.Parent.Parent.Box11 B12 = script.Parent.Parent.Box12
function onTouched(Part) if Part.Name == "Wing1" or "Wing2" then print(Part.Parent.Name) game.Workspace.Button1.Script.Disabled = false game.Workspace.Button2.Script.Disabled = false game.Workspace.Button3.Script.Disabled = false game.Workspace.Button4.Script.Disabled = false game.Workspace.Button5.Script.Disabled = false end if B1.Transparency == 1 then B1.Transparency = 0 B1.CanCollide = true elseif B2.Transparency == 1 then B2.Transparency = 0 B2.CanCollide = true elseif B3.Transparency == 1 then B3.Transparency = 0 B3.CanCollide = true elseif B4.Transparency == 1 then B4.Transparency = 0 B4.CanCollide = true elseif B5.Transparency == 1 then B5.Transparency = 0 B5.CanCollide = true elseif B6.Transparency == 1 then B6.Transparency = 0 B6.CanCollide = true elseif B7.Transparency == 1 then B7.Transparency = 0 B7.CanCollide = true elseif B8.Transparency == 1 then B8.Transparency = 0 B8.CanCollide = true elseif B9.Transparency == 1 then B9.Transparency = 0 B9.CanCollide = true elseif B10.Transparency == 1 then B10.Transparency = 0 B10.CanCollide = true elseif B11.Transparency == 1 then B11.Transparency = 0 B11.CanCollide = true elseif B12.Transparency == 1 then B12.Transparency = 0 B12.CanCollide = true end end
if B12.Transparency == 0 then script.Parent.Parent.NewTruck.Disabled = false end
script.Parent.Touched:connect(onTouched)
_________________________________________________________
See if this will work, it should print the parents name, if it doesn't then it's a hierarchy error. |
|
|
| Report Abuse |
|
|
twitchio
|
  |
| Joined: 13 Aug 2010 |
| Total Posts: 49 |
|
|
| 12 Jan 2013 07:17 PM |
Yes, it printed the name of the Parent and i didnt get the error But i added the Part.Parent:remove() back in and it print the name of the Parent but i got the error again |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 07:18 PM |
| Hm.. Try Part.Parent.Parent = nil |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2013 07:21 PM |
remove() was deleted
Use Destroy() or ClearAllChildren() |
|
|
| Report Abuse |
|
|
twitchio
|
  |
| Joined: 13 Aug 2010 |
| Total Posts: 49 |
|
|
| 12 Jan 2013 07:37 PM |
| Hmm... None of those seem to work |
|
|
| Report Abuse |
|
|
twitchio
|
  |
| Joined: 13 Aug 2010 |
| Total Posts: 49 |
|
| |
|