dasfunny
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 911 |
|
|
| 25 Jun 2012 12:44 PM |
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil then h.MaxHealh = h.Health + 10 h.Health = h.Health + 10 h.WalkSpeed = h.WalkSpeed - 2
end end
script.Parent.Touched:connect(onTouched)
How would I stop there health from going up if there health waas 1000 and up and there walkspeed was 0 or lower So basicly a cap
|
|
|
| Report Abuse |
|
|
|
| 25 Jun 2012 12:45 PM |
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil and h.MaxHealth ~= 1000 then h.MaxHealh = h.Health + 10 h.Health = h.Health + 10 h.WalkSpeed = h.WalkSpeed - 2 end end |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2012 12:48 PM |
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil then if h.MaxHealth < 1000 then h.MaxHealh = h.Health + 10 h.Health = h.Health + 10 h.WalkSpeed = h.WalkSpeed - 2
end end end
script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
dasfunny
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 911 |
|
|
| 25 Jun 2012 12:51 PM |
so
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil and h.MaxHealth ~= 1000 then h.MaxHealh = h.MaxHealth + 10 -- foorgot to fix the Error here h.Health = h.Health + 10 h.WalkSpeed = h.WalkSpeed - 2 end end
Still no work ANyone help?
|
|
|
| Report Abuse |
|
|
|
| 25 Jun 2012 12:51 PM |
| Yes, The's would actually be better in this case, as mine only checks the exact amount of "1000". |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2012 12:52 PM |
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil and h.MaxHealth < 1000 then h.MaxHealth = h.MaxHealth + 10 h.Health = h.Health + 10 h.WalkSpeed = h.WalkSpeed - 2 end end script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
dasfunny
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 911 |
|
|
| 25 Jun 2012 12:55 PM |
Wuld I do walkspeed the same way you did Health btw workss |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2012 12:58 PM |
No problem. And I would do:
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h then if h.MaxHealth < 1000 then h.MaxHealth = h.MaxHealth + 10 h.Health = h.Health + 10 elseif h.WalkSpeed < 20 then --or something else h.WalkSpeed = h.WalkSpeed - 2 end end end script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
dasfunny
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 911 |
|
|
| 25 Jun 2012 01:00 PM |
| is there Any wya to FIND the person that used the weapon and increase there Health and walkspeeD? |
|
|
| Report Abuse |
|
|
| |
|
dasfunny
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 911 |
|
|
| 25 Jun 2012 01:06 PM |
| No for example It doesn't Damage teh tools user. |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2012 01:16 PM |
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h and (h.MaxHealth < 1000) and (part.Parent~=script.Parent.Parent) then -- or wherever the player is from the tool h.MaxHealth = h.MaxHealth + 10 h.Health = h.Health + 10 elseif h.WalkSpeed < 20 then --or something else h.WalkSpeed = h.WalkSpeed - 2 end end end script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|