How to make a tool that heals people around you by touching the handle?

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.

3 Likes

ur trying to make an animation like 50 as health, after 0.5, 70 and ecc, or just 100?

2 Likes

I made it so the script heals you up to your max health

2 Likes
function onTouched(part)
	local h = part.Parent:FindFirstChild("Humanoid")
	if h then
		
		h.Health = "100"
		
	end
end

script.Parent.Touched:Connect(onTouched)

try, im not sure if it works

1 Like

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

1 Like

Well also there can be reason if you disabled CanTouch in handle Properties

1 Like

The script is not local, the humanoid name is humanoid

1 Like

I tested your script in my place and it worked normally, so maybe you messed up with CanTouch property of handle?

1 Like

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.

4 Likes

Tested it, cantouch is on, still did nothing. Y’all tested it in a tool right?

2 Likes

What tool are u using? And send a screenshot of where is the tool and script.

1 Like

Yeah, it works fine so we need extra info about script position. Is it inside of tool or handle of tool?

1 Like

Try to move the script under the Handle part, not the tool

And make sure it’s a script and not a local script.

Here’s the tool I’m using as a test: https://create.roblox.com/store/asset/16976066852/HealToolTest

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.

Just tried it, works perfectly fine for me with your original code.

TouchInterest will get created and parented to the Handle when the Touched event is being listened to on it.

1 Like

Did you use it in the tool model I gave?

Yes, i used your tool and your original code.