Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i make a healing brick!?

hi i was making a game where a part has to heal you but its no working please help

script.Parent.Touched:Connect (function(hit)
	if game.Players:GetPlayerFromCharacter (hit.Parent) then
		hit.Parent.Humanoid.Health = 10
	end
end)

1 comment

0

How much health do you want it to heal you?

3 answers

✓ Accepted answer
-- Put this Heal Script in the part
function onTouch(part) 
	local humanoid = part.Parent:FindFirstChild("Humanoid") 
	if (humanoid ~= nil) then
		humanoid.Health = 100 --change this number if the player's maxhealth is higher
		script.Disabled = true
	end 
end

script.Parent.Touched:connect(onTouch)


-- Cooldown script
while true do
	if script.Parent.Script.Disabled == true then
		wait (5) --change this number to change the cooldown length in seconds to easily change to minutes change it to amount_of_minutes*60 for example 3 minutes would be (3*60)
		script.Parent.Script.Disabled = false
	end
	wait (0.1)
end


Try this:


script.Parent.Touched:Connect(function(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent) then
		hit.Parent.Humanoid.Health = 100
	end
end)

if you want to make it add up, do this

script.Parent.Touched:Connect (function(hit)
    if game.Players:GetPlayerFromCharacter (hit.Parent) then
        hit.Parent.Humanoid.Health =  hit.Parent.Humanoid.Health + 7
    end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.