theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 27 Jan 2012 10:17 PM |
This script appears to not work. There is no output, not even from the print stuff. All it does is respawn a NPC, which I shall turn into an AI.
local ai = game.Workspace:FindFirstChild("Test Dummy") local base = game.Workspace:FindFirstChild("Base") local clone = ai:Clone()
if ai then
ai.Humanoid.Died:connect(function()
print(ai.Name.." has died.")
game:GetService("Debris"):AddItem(ai, 4)
print(ai.Name.." has been given a proper burial.")
wait(4)
clone.Parent = game.Workspace ai = game.Workspace:FindFirstChild("Test Dummy") clone = ai:Clone()
print(ai.Name.." has been reborn!")
end) end
"Death to lazy builders. Remove the CFrame tools. Command bar all the way." ~pauljkl |
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 27 Jan 2012 10:51 PM |
BUMP
"Death to lazy builders. Remove the CFrame tools. Command bar all the way." ~pauljkl |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 27 Jan 2012 10:52 PM |
| I think I had this experience before. Does the output say the event disconnects? And how come you don't make ai global? |
|
|
| Report Abuse |
|
|
|
| 27 Jan 2012 10:54 PM |
Are you testing this in studio by clicking the green play button? There is supposed to be a glitch where events don't trigger properly after pressing the reset button. Try resetting studio or going into play solo.
If not... I'll look into it. It looks fine? |
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 27 Jan 2012 10:55 PM |
Output says nothing. Local variables are destroyed at the end of the scope thingy, so if they are put at the top, they should be global. I heard it made access faster...
"Death to lazy builders. Remove the CFrame tools. Command bar all the way." ~pauljkl |
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 27 Jan 2012 10:59 PM |
Works in Play Solo, but not by pressing the green button. Now the AI just falls apart when spawned.
"Death to lazy builders. Remove the CFrame tools. Command bar all the way." ~pauljkl |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 27 Jan 2012 10:59 PM |
| I think your event gets disconnected. |
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 27 Jan 2012 11:10 PM |
After adding :MakeJoints(), it worked. Thanks! :D
"Death to lazy builders. Remove the CFrame tools. Command bar all the way." ~pauljkl |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 27 Jan 2012 11:25 PM |
After killing it twice, it decided that life wasn't worth living. Any way to fix that?
"Death to lazy builders. Remove the CFrame tools. Command bar all the way." ~pauljkl |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 27 Jan 2012 11:27 PM |
| NOW THAT I'M SURE IS BECAUSE OF THE EVENT! |
|
|
| Report Abuse |
|
|
|
| 27 Jan 2012 11:27 PM |
| Well, if you're removing the model and the script is in the model..The script gets deleted. So.. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 27 Jan 2012 11:28 PM |
| Had that same experience too. |
|
|
| Report Abuse |
|
|
|
| 27 Jan 2012 11:29 PM |
| What to do : Put the new model inside workspace before removing the model. |
|
|
| Report Abuse |
|
|
| |
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 27 Jan 2012 11:44 PM |
Putting it in Lighting, I have to manually move it out, otherwise the script doesn't run, to pull it out.
"Death to lazy builders. Remove the CFrame tools. Command bar all the way." ~pauljkl |
|
|
| Report Abuse |
|
|