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

How do I make a healing pad?

Asked by 10 years ago

I have a healing pad. I used a script.

game.Workspace.HealingPad.Health = 100

Is it the right one or not?

3 answers

Log in to vote
1
Answered by
Sublimus 992 Moderation Voter
10 years ago

You need it to function when a human touches it using the Touched event and then you need to change the players health (put this script inside the part):

script.Parent.Touched:connect(function(hit)
    if hit.Parent:findFirstChild("Humanoid") then -- Make sure it's a human
        hit.Parent.Humanoid.Health = hit.Parent.Humanoid.MaxHealth --No matter the health, refill it
    end
end)
Ad
Log in to vote
1
Answered by 10 years ago

Nope. You may want to try the following. Read the notes to help you. You're actually setting the part's health to 100, and the part does not have a property called health.

script.Parent.Touched:connect(function (hit)
    if not hit.Parent:findFirstChild("Humanoid") then return end --Cancels function if it's not a player that touches it.
    hit.Parent.Humanoid.Health = 100 --Sets the health of the touching player to 100.
end)

I'm Aurum, and you're welcome.

Log in to vote
0
Answered by 10 years ago

FIrst you need to learn the Touched event. SO when the Character touches the pad he/she gets more health. I suggest learning the touched event.

0
Thanks Roboy5857 20 — 10y

Answer this question