RB-004
Roblox heal pad script
A part that gives health back to players who stand on it.
- Script type
- Script
- Where it goes
- Inside the Part
- Category
- Hazards and pads
For your own game in Roblox Studio. Not for use in other people's games.
The code
-- Heal pad: restores health to a character that touches the part.
local HEAL_AMOUNT = 25 -- health given each time
local COOLDOWN = 1 -- seconds between heals for the same character
local part = script.Parent
local recentlyHealed = {}
part.Touched:Connect(function(hit)
local humanoid = hit.Parent and hit.Parent:FindFirstChildOfClass("Humanoid")
if not humanoid or humanoid.Health <= 0 then
return
end
if recentlyHealed[humanoid] then
return
end
recentlyHealed[humanoid] = true
humanoid.Health = math.min(humanoid.MaxHealth, humanoid.Health + HEAL_AMOUNT)
task.wait(COOLDOWN)
recentlyHealed[humanoid] = nil
end)How to set it up
- Insert a Part and colour it green so players know what it is.
- Add a Script inside the Part.
- Paste the code into the Script.
- Play, take some damage, and step on the pad.
Change it
- Set HEAL_AMOUNT to 100 for a full heal in one touch.
- Make COOLDOWN bigger (like 5) so a player cannot heal fast by jumping on and off.
- The math.min line stops health going above MaxHealth.
More in Hazards and pads
More Roblox tools
- Shirt and pants templatesFree Roblox clothing templates to download: hoodies, jerseys, jeans, joggers and more.
- Robux tax calculatorWork out what you receive after the marketplace fee, or what to charge.
- Robux to USD calculatorConvert earned Robux to dollars at a DevEx rate you can edit.
- Shirt and pants template makerColour each panel of the 585×559 clothing template and download it.
- Username generatorGenerate usernames that fit the 3–20 character rule.