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: Eh, some while loops trouble

Previous Thread :: Next Thread 
igeorge7159gotban is not online. igeorge7159gotban
Joined: 21 Jun 2011
Total Posts: 185
25 Apr 2014 09:02 PM
How can I make it so that it keeps checking if the zombie is deleted. If the zombie is deleted, it will say the messages in the script:

if not workspace:FindFirstChild("Zombie") then
msg = Instance.new("Message", Workspace)
msg.Text = "Josh the mic: Nice job killing the zombie."
wait(3)
msg:Destroy()
end
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
25 Apr 2014 09:07 PM
check=function()
if(Workspace['Zombie'])~=nil)then
msg=Instance.new('Message',workspace);
msg.Text='Josh on mic: Nice job killing the zombie.';
wait'3'msg:destroy''end end;
check(Workspace);
Report Abuse
igeorge7159gotban is not online. igeorge7159gotban
Joined: 21 Jun 2011
Total Posts: 185
25 Apr 2014 09:08 PM
How can I make it loop? Like right after he dies the loop will end and the message will appear?
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
25 Apr 2014 09:08 PM
Oops. forgot to add another parenthesis lol

check=function()
if((Workspace['Zombie'])~=nil)then
msg=Instance.new('Message',workspace);
msg.Text='Josh on mic: Nice job killing the zombie.';
wait'3'msg:destroy''end end;
check(Workspace);
Report Abuse
igeorge7159gotban is not online. igeorge7159gotban
Joined: 21 Jun 2011
Total Posts: 185
25 Apr 2014 09:11 PM
Still didn't answer my question.
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
25 Apr 2014 09:11 PM
You use the .Died event to 'check' if it is dead

check=function()
Workspace['Zombie'].Humanoid.Died:connect(function(a)
if(a.Parent.Health==0)then
msg=Instance.new('Message',workspace);
msg.Text='Josh on mic: Nice job killing the zombie'
wait'3'msg:destroy''end end)end;
check(Workspace.Zombie);
Report Abuse
igeorge7159gotban is not online. igeorge7159gotban
Joined: 21 Jun 2011
Total Posts: 185
25 Apr 2014 09:14 PM
The zombie gets deleted right when he dies.
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
25 Apr 2014 09:15 PM
isn't that what you want? unless ou want your map cluttered with dead humanoids lol
Report Abuse
igeorge7159gotban is not online. igeorge7159gotban
Joined: 21 Jun 2011
Total Posts: 185
25 Apr 2014 09:16 PM
Ugh, let me repeat this again: How can I make it so it does a loop check to see if the zombie doesn't exist. If it doesn't exist, it will do the rest.
Report Abuse
NeonRiver is not online. NeonRiver
Joined: 12 Feb 2013
Total Posts: 4936
25 Apr 2014 09:20 PM
[ Content Deleted ]
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
25 Apr 2014 09:39 PM
...

check=function()
if(Workspace.Zombie~=nil)then
pcall(function()
while wait'1'do
Workspace['Zombie'].Humanoid.Died:connect(function(a)
if(a.Parent.Health==0)then
msg=Instance.new('Message',workspace);
msg.Text='Josh on mic: Nice job killing the zombie'
wait'3'msg:destroy''
end end)end end)end end;
check(Workspace.Zombie);


does that solve ur problem sir
Report Abuse
igeorge7159gotban is not online. igeorge7159gotban
Joined: 21 Jun 2011
Total Posts: 185
26 Apr 2014 12:38 AM
Yes daddy
Report Abuse
igeorge7159gotban is not online. igeorge7159gotban
Joined: 21 Jun 2011
Total Posts: 185
26 Apr 2014 12:47 AM
Doesn't work because you make it too complicated
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
26 Apr 2014 12:58 AM
how is it too complicated this is basic stuff
Do you know Lua or not?
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
26 Apr 2014 01:03 AM
while wait() do
if Workspace["Zombie"]["Zombie"].Health < 1 then -- Change the second Zombie to the name of the Zombie's humanoid.
local msg = Instance.new("Message", Workspace)
msg.Text = "Josh the mic: Nice job killing the zombie."
wait(3)
msg:Destroy() break
end
end
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
26 Apr 2014 01:08 AM
This also works :

zombie = Workspace["Zombie"] -- Change "Zombie" to the name of the Zombie.
humanoid = zombie:FindFirstChild("Zombie") -- Change "Zombie" to the Zombie's Humanoid name.

while wait() do
if humanoid and humanoid.Health < 1 then
local msg = Instance.new("Message", Workspace)
msg.Text = "Josh the mic: Nice job killing the zombie."
wait(3)
msg:Destroy() break
else wait(5) print "Error[Zombie not dead, or not found.]"
end
end
Report Abuse
igeorge7159gotban is not online. igeorge7159gotban
Joined: 21 Jun 2011
Total Posts: 185
26 Apr 2014 01:12 AM
Well the point is TransIate, it doesn't work
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
26 Apr 2014 01:21 AM
works for me lol
Report Abuse
igeorge7159gotban is not online. igeorge7159gotban
Joined: 21 Jun 2011
Total Posts: 185
26 Apr 2014 01:23 AM
You need to see the whole script though. Get on skype dude.
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
26 Apr 2014 01:41 AM
Who are you? lol
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
26 Apr 2014 04:44 AM
Workspace.Zombie.Humanoid.Died:connect(function()
--Do you stuff
end)


Change Zombie to his name

If he has a "Zombie" inside him change the Humanoid to Zombie.

If he has a "Monster" change Humanoid to Monster

(Do this only if it has a little robloxian, not a script)


Transiate, take it easy on him, he obviously don't know a Lua
Report Abuse
igeorge7159gotban is not online. igeorge7159gotban
Joined: 21 Jun 2011
Total Posts: 185
26 Apr 2014 05:50 AM
@TransLate It's Venom (LordAbolition)

@war I do know Lua. Is this forum meant to only people that don't know Lua? I'm working on a zombie survival game based off of Contamination with absolutely no free models. All from scratch. Even the zombie I scripted. So don't judge people until you know them well.
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
26 Apr 2014 05:59 AM
How can you say you 'know' Lua if you can't even create a loop?
Report Abuse
igeorge7159gotban is not online. igeorge7159gotban
Joined: 21 Jun 2011
Total Posts: 185
26 Apr 2014 06:03 AM
I know how to create a loop. I'm just wondering how to make the loop end. Or does it end automatically?
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
26 Apr 2014 06:11 AM
while true do break end
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