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
 

regen script troubles

Previous Thread :: Next Thread 
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
28 Jun 2014 01:29 PM
so i am trying to make a regen script that regenerates +5 health while youre touching a part called mat this is my script so far that has crashed LOL
--------------------------------------------
while true do
deb=false
script.Parent.Touched:connect(function(hit)
if not deb then deb=true
human=hit.Parent:findFirstChild("Humanoid")
if human then
human.Health=human.Health+5
end
wait(2)--denounce time
deb=false
end
end)
end
Report Abuse
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
28 Jun 2014 01:48 PM
please help i dont have much time left
Report Abuse
super10099 is not online. super10099
Joined: 30 Jan 2010
Total Posts: 1102
28 Jun 2014 02:02 PM
debounce = false

script.Parent.Touched:connect(function(hit)
if not debounce then debounce = true
local human = hit.Parent:FindFirstChild("Humanoid")
if human then
human.Health = human.Health+5
wait(2)
debounce = false
end
end
end)
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
28 Jun 2014 02:02 PM
Healing = false
DB = false


script.Parent.Touched:connect(function(h)
local Hum = h.Parent:FindFirstChild("Humanoid")
if Healing == false and DB == false and Hum then
Healing, DB = true, true
wait(2) --Debounce, make sure they stand here at least 2 seconds
DB = false
while Healing == true do
Hum.Health = Hum.Health + 5
end
end
end)

script.Parent.TouchEnded:connect(function(h)
local Hum = h.Parent:FindFirstChild("Humanoid")
if Hum then
Healing = false
end
end)



--It can only heal one person at a time :D Just an added bonus XD
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
28 Jun 2014 02:03 PM
Healing = false
DB = false


script.Parent.Touched:connect(function(h)
local Hum = h.Parent:FindFirstChild("Humanoid")
if Healing == false and DB == false and Hum then
Healing, DB = true, true
while Healing == true do
Hum.Health = Hum.Health + 5
end
end
end)

script.Parent.TouchEnded:connect(function(h)
local Hum = h.Parent:FindFirstChild("Humanoid")
if Healing and DB and Hum then
Healing, DB = false,false
end
end)



--It can only heal one person at a time :D Just an added bonus XD
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