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

How do I make it so a block you enter gives you health?

My idea is that a brick that you enter (invisible, noncollision) will give you, say, 1000 health. Then when you exit the brick it will bring you back to 100 health.

Here's what I have so far:

local Heal = game.Workspace.Healer

Heal.Touched:connect(function(hit)
local humanoid = script.Parent:FindFirstChild("Humanoid") 
	if (humanoid ~= nil) then
		humanoid.Health = humanoid.MaxHealth ~= 1000
	end 
end)


Heal.TouchEnded:connect(function(leave)
local humanoid = script.Parent:FindFirstChild("Humanoid") 
	if (humanoid ~= nil) then
		humanoid.Health = humanoid.MaxHealth ~= 100
	end 
end)

5 comments

1

humanoid.MaxHealth = NUM

0

Do what TheeDeath said, on lines 06 and 14

0

I tried, but the '=' sign was underlined with red and it didn't give me any health

0

^ What did the error say?

0

It says there was something missing around '='

1 answer

local Heal = game.Workspace.Healer

Heal.Touched:Connect(function(hit)
local humanoid = script.Parent:FindFirstChild("Humanoid") 
    if (humanoid ~= nil) then
        humanoid.Health = humanoid.Health - 1 --SUBTRACTS HEALTH
    end 
end)


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