ExosXguy
|
  |
| Joined: 10 Oct 2010 |
| Total Posts: 2239 |
|
|
| 21 Jun 2013 02:08 PM |
Can't seem to get my head around it. It worked changing a torso's transparency, but not for cloning GUI's into the player's PlayerGui.
while true do local p = game.Players:GetChildren() for i=1,#p do if ((p[i].Character.Torso.Position - script.Parent.Position).magnitude < script.Parent.Size.magnitude*2) then a = script.Lift2:Clone() -- Around here it starts to mess up, output pasted below a.Parent = p[i].PlayerGui elseif ((p[i].Character.Torso.Position - script.Parent.Position).magnitude > script.Parent.Size.magnitude*2) then a:Remove() end end wait() end
Output:
20:01:22.200 - Workspace.Lf2.Teleport:8: attempt to index global 'a' (a nil value)
|
|
|
| Report Abuse |
|
|
sbk28
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 2528 |
|
|
| 21 Jun 2013 02:12 PM |
"Remove()"
:remove()
or
:Destroy()
try that
not sure if that's your error though |
|
|
| Report Abuse |
|
|
| |
|
sbk28
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 2528 |
|
|
| 21 Jun 2013 02:14 PM |
Why do I get the feeling you can do
":Remove()"
now
ugh, I never pay attention to this. I always use :Destroy()
but if you're going to tell me to hop off at least give him an answer |
|
|
| Report Abuse |
|
|
ExosXguy
|
  |
| Joined: 10 Oct 2010 |
| Total Posts: 2239 |
|
|
| 21 Jun 2013 02:15 PM |
Unsubstantial is on steam with me @Sbk
And no worries, I found the error myself, the elseif statement didn't know what 'a' was, so I made some fixes. |
|
|
| Report Abuse |
|
|
sbk28
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 2528 |
|
|
| 21 Jun 2013 02:16 PM |
after checking
You only make A if something happens
but you delete it in elseif |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2013 02:16 PM |
ok - here: It's either trying to remove something which is nil, meaning you should add somewhere in the if statement "and a~=nil" else - it's probably because "a" wasn't defined, since it skipped to the elseif statement. |
|
|
| Report Abuse |
|
|
sbk28
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 2528 |
|
|
| 21 Jun 2013 02:16 PM |
okay nvm then
I feel kind of stupid now.
I apologize for that issue before, I only ever use ":Destroy()" or "Debris.AddItem()" |
|
|
| Report Abuse |
|
|