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

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

Asked by
F_lipe 135
8 years ago

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?

Closed as Not Constructive by EzraNehemiah_TF2, unmiss, GoldenPhysics, and M39a9am3R

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 8 years ago

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

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. EzraNehemiah_TF2 3552 — 8y
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. M39a9am3R 3210 — 8y
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. M39a9am3R 3210 — 8y
Ad