|
| 02 May 2014 09:05 PM |
I'm trying to make it so, when the character moves, your health stops regenerating. I deleted ROBLOX's main health script, and inserted this. When you stop moving, your character is supposed to regenerate health again until you move, and so on.
script.Parent.Parent.Parent.Character:WaitForChild("Humanoid").Running:connect(function(speed) a = script.Parent.Parent.Parent.Character:WaitForChild("Humanoid") while wait(1) do if speed == 0 then if a.Health > 0 and a.Health < 100 then a.Health = a.Health + 0.1 else break end end end end)
[ Xzavion War-Chief ] - [ TSC Imperator ] |
|
|
| Report Abuse |
|
|
|
| 02 May 2014 09:14 PM |
Bump.
[ Xzavion War-Chief ] - [ TSC Imperator ] |
|
|
| Report Abuse |
|
|
|
| 02 May 2014 09:21 PM |
Bump..
[ Xzavion War-Chief ] - [ TSC Imperator ] |
|
|
| Report Abuse |
|
|
|
| 02 May 2014 10:05 PM |
Bump3..
[ Xzavion War-Chief ] - [ TSC Imperator ] |
|
|
| Report Abuse |
|
|
|
| 02 May 2014 10:08 PM |
script.Parent.Parent.Parent.Character:WaitForChild("Humanoid").Running:connect(function(speed) a = script.Parent.Parent.Parent.Character:WaitForChild("Humanoid") speed=0 a.Running:connect(function(spe)speed=spe end)
while wait(1) do if speed==0 and a.Health > 0 and a.Health < 100 then a.Health = a.Health + 0.1 end end
|
|
|
| Report Abuse |
|
|
|
| 02 May 2014 10:09 PM |
| wait? you already have speed. I dont see the problem other than you putting 'break' in there and making it not repeat the loop. |
|
|
| Report Abuse |
|
|
|
| 02 May 2014 10:24 PM |
@Pres That doesn't work, I tried. Test that at your place, damage yourself, and walk, watch your health.
[ Xzavion War-Chief ] - [ TSC Imperator ] |
|
|
| Report Abuse |
|
|
|
| 03 May 2014 11:21 AM |
local curSpeed = 0
local hum = script.Parent.Humanoid hum.Running:connect(function (speed) curSpeed = speed end)
while wait(1) do if curSpeed == 0 then hum.Health = hum.Health + (hum.MaxHealth/1000) end end |
|
|
| Report Abuse |
|
|