Hey, so I’m trying to make a tool that when a part of it is touched, it will heal people touching it. For some reason, it is not healing the person. I put this script in the handle. Can someone help me out? if so that’d be great!
Script:
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
local heal = h.MaxHealth
if h then
h.Health = heal
wait(.5)
end
end
script.Parent.Touched:connect(onTouched)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
if its usual script(not local) then i dont see any reason why it isnt healing people. Are you sure the name of player humanoid is Humanoid? you could use findFirstChildOfClass(“Humanoid”) to heal any existing hum
Just tested your script, it works perfectly fine for me. Are you sure the other person is touching the Handle of the tool? Is CanTouch enabled on the Handle itself? Try printing inside the event to make sure it even runs.
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
local heal = h.MaxHealth
if h then
h.Health = 100
end
end
script.Parent.Touched:connect(onTouched)
Try to see if it works with can collide as you turned off it.