|
| 14 Feb 2012 07:42 PM |
I was reading the wiki, and I stumbled across a question ... What would be for no health?
h.Maxhealth
h.???health
~Thank for your patience and time, Greedy |
|
|
| Report Abuse |
|
|
mage11561
|
  |
| Joined: 03 Sep 2008 |
| Total Posts: 13217 |
|
|
| 14 Feb 2012 07:46 PM |
Max Health is the maximum health whilst Health is the current.
h.Health = 0 would make your health 0, AKA dead |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2012 07:50 PM |
so...
h.health = 0
or...
h.health= 0health
? |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 14 Feb 2012 07:52 PM |
Humanoid.MaxHealth=math.huge should work
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2012 07:53 PM |
h.Health = 0
but you have to make 'h' a variable first. and 'health' is wrong has to be 'Health'
so here's what you do
h = Instance.new("Humanoid") h.Health = 0
or
h.MaxHealth = 0
they both end up in death
but most people us 'MaxHealth' because when some people use health but the other person they're making the health on there MaxHealth is like math.huge and if they use health the victim wouldn't die so MaxHealth is perferbly the best option |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2012 07:56 PM |
-- Script to kill humanoid when drowning.
h = Instance.new("Humanoid") Script.Parent.Touched:(function(WaterBottom) Local h = WaterBottom.Parent:findFirstChild("Humanoid") if h then h.health = 0 end end)
so would that work? |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2012 07:59 PM |
No
h = Instance.new("Humanoid") Script.Parent.Touched:conncet(function(WaterBottom) Local h = WaterBottom.Parent:findFirstChild("Humanoid") if h and h.Health = 100 then h.Health = 0 end end)
|
|
|
| Report Abuse |
|
|
|
| 14 Feb 2012 08:03 PM |
Ill go with that but my mind is telling me ...
what if their health isn't 100? |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2012 08:07 PM |
then remove the 'and h.Health = 100' part but if you're talking about something else then remove 'and h.Health = 100' and the 'h.Health = 0' line put it to 'h.MaxHealth = 0' because as I said, MaxHealth is ALL THERE HEALTH so it dont matter if there health is like 013030130101 or PI you can easily change it with MaxHealth property |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2012 08:12 PM |
my problem is it still isn't working, this is what I got.
-- Script to kill humanoid when drowning.
Script.Parent.Touched:(function(WaterBottom) Local h = WaterBottom.Parent:findFirstChild("Humanoid") if h and h.health = 100 then h.health = 0 end end)
Just say whats wrong and ill try to fix it. |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2012 08:15 PM |
| Where it sas health anywhere replace it with 'Health' it wont work with 'health' cuz health isn't a property, only Health is. |
|
|
| Report Abuse |
|
|
jCode
|
  |
| Joined: 12 Feb 2012 |
| Total Posts: 33 |
|
|
| 14 Feb 2012 08:15 PM |
script.Parent.Touched:connect(function(partObject) local playerObject = game:GetService("Players"):GetPlayerFromCharacter(partObject.Parent) if playerObject then partObject.Parent:BreakJoints() end end)
{ Proficient in, but not limited to - RBX.Lua } |
|
|
| Report Abuse |
|
|
yobrobob
|
  |
| Joined: 26 Nov 2011 |
| Total Posts: 71 |
|
|
| 14 Feb 2012 08:18 PM |
| Not the same question but similar how do I make the people with the blue help button :/ |
|
|
| Report Abuse |
|
|
jCode
|
  |
| Joined: 12 Feb 2012 |
| Total Posts: 33 |
|
|
| 14 Feb 2012 08:20 PM |
@yobro
Create a person.
Insert a Dialog into the person.
{ Proficient in, but not limited to - RBX.Lua } |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2012 08:22 PM |
Ok, Heres what I want: 1. I don't want a script handed to me 2. I'd like help on FIXING it.
Here's what I got:
-- Script to kill humanoid when drowning.
Script.Parent.Touched:(function(WaterBottom) Local h = WaterBottom.Parent:findFirstChild("Humanoid") if h and h.Health = 100 then h.Health = 0 end end) |
|
|
| Report Abuse |
|
|
jCode
|
  |
| Joined: 12 Feb 2012 |
| Total Posts: 33 |
|
|
| 14 Feb 2012 08:24 PM |
script.Parent.Touched:(function(WaterBottom) local h = WaterBottom.Parent:FindFirstChild("Humanoid") if h and h.Health == 100 then h.Health = 0 end end)
I just edited yours so it would work in my first post, not "handing it to you."
{ Proficient in, but not limited to - RBX.Lua } |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Feb 2012 08:28 PM |
Oh sorry I made a mistake in my last Lua code post, it's supposed to be '==' not = because we want to know if The person's health is EQUAL to 100. Tip: Always when using an if statement, or elseif I think do '==' if you're trying to identify if something is equal to that thing. |
|
|
| Report Abuse |
|
|
jCode
|
  |
| Joined: 12 Feb 2012 |
| Total Posts: 33 |
|
|
| 14 Feb 2012 08:31 PM |
Yes, besides some minor capitalization errors that didn't have any effect on your script otherwise. Local, script, and FindFirstChild were incorrectly spelled (Local, Script, findFirstChild). But as I said before, those were not problems, just bad habits.
{ Proficient in, but not limited to - RBX.Lua } |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2012 08:41 PM |
| :FindFirstChild( ) or :findFirstChild( ) both work |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2012 09:18 PM |
Yes, but :findFirstChild() is deprecated, as all (if not most?) camelCases are.
† KMXD † |
|
|
| Report Abuse |
|
|
aboy5643
|
  |
| Joined: 08 Oct 2010 |
| Total Posts: 5458 |
|
|
| 14 Feb 2012 09:39 PM |
Oh my... The quality of the help has gone down the drain...
If you want this to kill someone that touches the "WaterBottom" (put the script inside the brick that does the killing) then use this (I will comment it all):
script.Parent.Touched:connect(function(p) -- If it touches, connect the event to the function local humanoid = p.Parent:FindFirstChild("Humanoid") -- Find the humanoid if humanoid then -- Make sure the humanoid is there humanoid.MaxHealth = 0 -- Set the max health to 0 end -- close the if statement end) -- close the function and the connection
"Locked" - Sorcus |
|
|
| Report Abuse |
|
|