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 11 years ago

I have a healing pad. I used a script.

1game.Workspace.HealingPad.Health = 100

Is it the right one or not?

3 answers

Log in to vote
1
Answered by
Sublimus 992 Moderation Voter
11 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):

1script.Parent.Touched:connect(function(hit)
2    if hit.Parent:findFirstChild("Humanoid") then -- Make sure it's a human
3        hit.Parent.Humanoid.Health = hit.Parent.Humanoid.MaxHealth --No matter the health, refill it
4    end
5end)
Ad
Log in to vote
1
Answered by 11 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.

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

I'm Aurum, and you're welcome.

Log in to vote
0
Answered by 11 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 — 11y

Answer this question