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: I need help with my health script.

Previous Thread :: Next Thread 
DarkheartSkillz is not online. DarkheartSkillz
Joined: 30 Sep 2011
Total Posts: 5125
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
DarkheartSkillz is not online. DarkheartSkillz
Joined: 30 Sep 2011
Total Posts: 5125
02 May 2014 09:14 PM
Bump.

[ Xzavion War-Chief ] - [ TSC Imperator ]
Report Abuse
DarkheartSkillz is not online. DarkheartSkillz
Joined: 30 Sep 2011
Total Posts: 5125
02 May 2014 09:21 PM
Bump..

[ Xzavion War-Chief ] - [ TSC Imperator ]
Report Abuse
DarkheartSkillz is not online. DarkheartSkillz
Joined: 30 Sep 2011
Total Posts: 5125
02 May 2014 10:05 PM
Bump3..

[ Xzavion War-Chief ] - [ TSC Imperator ]
Report Abuse
Prescience is not online. Prescience
Joined: 26 Apr 2014
Total Posts: 188
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
Prescience is not online. Prescience
Joined: 26 Apr 2014
Total Posts: 188
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
DarkheartSkillz is not online. DarkheartSkillz
Joined: 30 Sep 2011
Total Posts: 5125
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
TehIcyStar is not online. TehIcyStar
Joined: 07 Mar 2010
Total Posts: 1649
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
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