robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 19 Jun 2012 10:15 AM |
So i got this script
waittime = 60 removetime = 60
while true do wait(waittime) a=game.Lighting.Zombie:clone() a.Position = script.Parent.Position wait(removetime) a:remove() end
When u kill the zombie with a gun, he gets removed, so if u kill him, the script breaks. I need to fix it. Someone help me?
|
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 19 Jun 2012 10:17 AM |
You never parented Zombie to Workspace.
And I would use Destroy(). |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 19 Jun 2012 10:26 AM |
| Miz, i was lazy and i made this 90% replica of the script. The real script works, but i need to know "nil" |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 19 Jun 2012 10:31 AM |
Then why not just ask what nil is :o
Nil means non existence, nothing. Mostly, you use it to check if something is in Workspace or not but it's especially used in outputs. |
|
|
| Report Abuse |
|
|
Uuvinu
|
  |
| Joined: 19 Apr 2012 |
| Total Posts: 2206 |
|
|
| 19 Jun 2012 10:32 AM |
nil means nothing essentially.
Someone will have a more accurate definition.
Parent = nil means you put the parent in nothing. It doesn't remove so you can still modify it, but it's parented in nothing. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 19 Jun 2012 10:33 AM |
| If you parent something to nil, it's like saying Remove(). Which is pretty much deprecated. |
|
|
| Report Abuse |
|
|
Uuvinu
|
  |
| Joined: 19 Apr 2012 |
| Total Posts: 2206 |
|
|
| 19 Jun 2012 10:34 AM |
:Remove() and parenting to nil isn't the same.
model.Parent = nil model.Parent = workspace -- models parent is workspace
model:Remove() model.Parent = workspace -- generates an error saying model is nil
model = nil is like :Remove() |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 19 Jun 2012 10:38 AM |
| I meant when using them it isn't fully removed, just locked. That's what I meant by like. |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 19 Jun 2012 10:49 AM |
| dude can you just fix my script? D: please ur my hero :3 |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 19 Jun 2012 10:50 AM |
| I told you what's wrong. You didn't parent it to Workspace. Parent it to Workspace. |
|
|
| Report Abuse |
|
|
Uuvinu
|
  |
| Joined: 19 Apr 2012 |
| Total Posts: 2206 |
|
|
| 19 Jun 2012 10:51 AM |
local waittime = 60 local removetime = 60
while true do wait(waittime) local a = game.Lighting.Zombie:clone() a.Position = script.Parent.Position a.Parent = game.Workspace a:MakeJoints() wait(removetime) a:Destroy() end |
|
|
| Report Abuse |
|
|