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: While True?

Previous Thread :: Next Thread 
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
27 Apr 2013 01:02 PM
I have this

while true do
if script.Parent.Humanoid.Health = 0 then
script.Parent.Head.Anchored = false
wait(0.1)
BOOM = Instance.new("Explosion")
BOOM.Parent = script.Parent.Head
end

What i want it to do is if the models humanoid = 0 then to make an explosion where the head is somone help please?
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
27 Apr 2013 01:43 PM
i take it this is done
Report Abuse
Vendicular is not online. Vendicular
Joined: 12 Apr 2013
Total Posts: 218
27 Apr 2013 01:52 PM
while true do
if script.Parent.Humanoid.Health == 0 then
script.Parent.Head.Anchored = false
wait(0.1)
BOOM = Instance.new("Explosion")
BOOM.Parent = script.Parent.Head
end
end

You left out an end, and the health part has to have 2 equal sign.
Try the wiki.

-= Holy mother of monkey milk! =-
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
27 Apr 2013 01:56 PM
script.Parent.Humanoid.Died:connect(function()
local Head = script.Parent:FindFirstChild("Head")
local BOOM = Instance.new("Explosion")
if Head then
BOOM.Position = Head.Position
BOOM.Parent = Head
Head.Anchored = false
end
end)
Report Abuse
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
27 Apr 2013 02:37 PM
It didnt work D; i guess its unfixable ):
Report Abuse
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
27 Apr 2013 02:44 PM
Somone please help me ;DDDDDDDDDD
Report Abuse
Jammintoad is online. Jammintoad
Joined: 08 Feb 2009
Total Posts: 10239
27 Apr 2013 02:47 PM
a == true
while a == true do
if script.Parent.Humanoid.Health == 0 then
a = false
script.Parent.Head.Anchored = false
wait(0.1)
BOOM = Instance.new("Explosion")
BOOM.Parent = script.Parent.Head
end
end
Report Abuse
Jammintoad is online. Jammintoad
Joined: 08 Feb 2009
Total Posts: 10239
27 Apr 2013 02:48 PM
woops wrong variable

a = true
while a == true do
if script.Parent.Humanoid.Health == 0 then
a = false
script.Parent.Head.Anchored = false
wait(0.1)
BOOM = Instance.new("Explosion")
BOOM.Parent = script.Parent.Head
end
end
Report Abuse
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
27 Apr 2013 02:53 PM
Jammin
My game crashed D:

I want it so the explosion ONLY comes when the models health is at 0
Report Abuse
Jammintoad is online. Jammintoad
Joined: 08 Feb 2009
Total Posts: 10239
27 Apr 2013 02:54 PM
You used the 2nd script?
:(
Report Abuse
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
27 Apr 2013 02:59 PM
Wait what?
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
27 Apr 2013 03:00 PM
I AM GETTING SCARED!

Why, why, why... You lag your games with infinite loops, mix up == and = ect. ): Sorry if I'm kinda harsh, but I see too many of these nowadays... x_x


By the way, why shouldn't notsopwnedg's solution work? Haven't tested it, but I don't see anything wrong with it (unless you put the script OUTSIDE the Player's Character<<<)


- As, mommy, SH is scaring ):
Report Abuse
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
27 Apr 2013 03:02 PM
Ok it is not a person
Its in a model
With a one brick things called head and the humanoid is in the model and so is the script would this make it a problem?
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
27 Apr 2013 03:04 PM
No, I just think that Humanoids are mostly used in Player characters (or AIs, but then I have to be informed :/)


- As, omnom22.
Report Abuse
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
27 Apr 2013 03:24 PM
So it wont work?
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
27 Apr 2013 04:04 PM
I believe that notsopwnedg's solution should work. But the other stuff seems to be buggish.


- As, speak to Outputbot.
Report Abuse
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
27 Apr 2013 05:37 PM
Doesnot work i guess it is not posible
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
27 Apr 2013 05:48 PM
Everything
is
possible.

^ That's what I think.


:3

- As, it's possible to hax life too.
Report Abuse
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
27 Apr 2013 05:52 PM
Sooo how come this wont work!
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
27 Apr 2013 05:56 PM
Okay, let's take a look on his code:
-------------------------------------------------
script.Parent.Humanoid.Died:connect(function()
local Head = script.Parent:FindFirstChild("Head")
local BOOM = Instance.new("Explosion")
if Head then
BOOM.Position = Head.Position
BOOM.Parent = Head
Head.Anchored = false
end
end)
-------------------------------------------------

I have a few questions:
- Where is the script located?
- Does the Head get removed upon death?

Now, try add in checks, like this:
-------------------------------------------------
script.Parent.Humanoid.Died:connect(function()
print("Died")
local Head = script.Parent:FindFirstChild("Head")
local BOOM = Instance.new("Explosion")
print("Head:",Head)
if Head then
BOOM.Position = Head.Position
BOOM.Parent = Head
Head.Anchored = false
end
end)
print("Loaded script")
-------------------------------------------------

Then, tell me what your output window says, so we can locate the problem!


- As, there's a wiki page for how to read an error.
Report Abuse
WillieTehWierdo200 is not online. WillieTehWierdo200
Joined: 13 Aug 2008
Total Posts: 1147
27 Apr 2013 06:00 PM
This should work...

script.Parent.Humanoid.Died:connect(function()
BOOM = Instance.new("Explosion")
BOOM.Position = script.Parent.Head.Position
BOOM.Parent = game.Workspace
end)
Report Abuse
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
27 Apr 2013 06:58 PM
All it said when i first started was Loaded Script ):
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
27 Apr 2013 07:00 PM
Okay, so either you never killed the Humanoid, or... yeah, dunno what the problem then could be.

Try kill it, and look for red text in your output. Oh yeah, and still the "Died" print<


- As, keep me bored pliz.
Report Abuse
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
27 Apr 2013 07:01 PM
Nope, and died you mean by killing it with a weapon or changeing its humanoid to 0?
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
27 Apr 2013 07:32 PM
Whatever makes the health bar go to 0.

Hm, it's weird that the .Died event didn't trigger. Can you send me the model?



- As, lol, just looked at the... new stamper tool? o_o I guess I'm late.
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