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: Respawning an AI

Previous Thread :: Next Thread 
theopfor is not online. 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 is not online. 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 is not online. 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
TheImpersonator is not online. TheImpersonator
Joined: 19 Jul 2011
Total Posts: 111
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 is not online. 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 is not online. 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 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
27 Jan 2012 10:59 PM
I think your event gets disconnected.
Report Abuse
theopfor is not online. 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 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
27 Jan 2012 11:12 PM
Welcome.
Report Abuse
theopfor is not online. 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 is not online. 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
darkkiller5555 is not online. darkkiller5555
Joined: 22 Nov 2009
Total Posts: 6359
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 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
27 Jan 2012 11:28 PM
Had that same experience too.
Report Abuse
darkkiller5555 is not online. darkkiller5555
Joined: 22 Nov 2009
Total Posts: 6359
27 Jan 2012 11:29 PM
What to do : Put the new model inside workspace before removing the model.
Report Abuse
FreeGamesROBLOX is not online. FreeGamesROBLOX
Joined: 15 Jun 2011
Total Posts: 6622
27 Jan 2012 11:31 PM
Lighting would be better
Report Abuse
theopfor is not online. 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
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