Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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)
1
`humanoid.MaxHealth = NUM` TheeDeathCaster 2368 — 6y
0
Do what TheeDeath said, on lines 06 and 14 RockerCaleb1234 282 — 6y
0
I tried, but the '=' sign was underlined with red and it didn't give me any health Sound_Drout 0 — 6y
0
^ What did the error say? TheeDeathCaster 2368 — 6y
0
It says there was something missing around '=' Sound_Drout 0 — 6y

1 answer

Log in to vote
0
Answered by
GingeyLol 338 Moderation Voter
6 years ago
Edited 6 years ago
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)


Ad

Answer this question