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?
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
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?