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

Brick that heals while someone is touching it, best method?

I'm trying to find what would be best way to go about making a brick that if someone is in it, the brick will passively heal them

Would the best method for me be go at this same way you would making a raycast beam that damages a players except making it add health?

1 comment

1 answer

I'll fix your problems!

First we use the function Touched. When the part is touched, this function will activate.

script.Parent.Touched:connect(function()

end)

Next step is to find out what hit the part. Fill in the argument after function to hit.

script.Parent.Touched:connect(function(hit)

end)

Now, we check if it is actually a human that is touching it. For that, we use FindFirstChild.

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then -- if its a player than go on
end)

If it was a player, now we give them the health.

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health + 100 --this fully heals them. you can change it at any time.
end)

Is something not working or something you don't understand? Message me on ROBLOX! (Lukeisbossman64)

=D

3 comments

0

Why did you spend all this hard work and effort trying to help a bad question? You might be new but the question that he posted up does not follow community guidelines and would of been moderated. I'm one of the moderators and we need a few more people to check it out before the question gets removed. Sorry you wasted your time.

0

LordDragonZord is not a moderator. He's a member of our community. What he does have is question moderation powers as you obtain these privileges at 40 reputation points. If a user is claiming to be a moderator however does not have the Community Moderator Ribbon or Site Logo Administrator badge, let us know.

0

Anyway, he is right. We typically do not accept questions that are of a requesting nature. We do provide advice for the user to attempt the problem themselves then lock their questions. If you have questions about our moderation system, check out our help page.

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