I am making an item that promotes humanoid.health.But nothing happens. Why?

I am making an item that promotes humanoid.health.But nothing happens. Why?

local Player = game:GetService("Players")
local SparksHeal = script.Parent:WaitForChild("SparksHeal")

script.Parent.Handle.Touched:Connect(function(hit)
	
	local CarHumanoid = hit.Parent:FindFirstChild("Humanoid")

	if CarHumanoid then
		
		CarHumanoid.Health +=1
		SparksHeal.Enabled = true
		
	end
	
	SparksHeal.Enabled = false
end)

Thats a tool or accessory? Why using on Touch? First verify that the Touched event triggered, add a print() inside the function

It’s a tool
I tried to print it, but it won’t print it out

Thei idea is to restore the health of the player who equip the tool? then use the Equipped event from the Tool

No, it’s about treating the other person.

Oh ok, like a Healing tool, and the user can heal other players?
If you want to use the Touched event, try adding an invisible collision box welded to the handle, big enough to actually collide with other players, and connect the Touched event to tat invisible collision box.

Or you could do it, on Tool.Activated and getting a Target player to heal, reading distance and the most closer player that is inside a range.
Or any other mechanic in which the user of the tool chooses the target player to heal

I’ve already done it and asked the question There’s a huge invisible crash part, but it doesn’t work. I’ll show you the video

That car has a Humanoid? the one you want to heal?

In that case, do not use the touched event to get the Humanoid instance. Get the Humanoid target from a different mechanic, like, showing a prompt or something the player can Heal the car.

If you still want to use the Touched event, check the prints you get from the Touch event, when colliding with the car, first dont get on the ground, just touch the car with the tool to check you are getting prints

Try this

local Player = game:GetService("Players")
local SparksHeal = script.Parent:WaitForChild("SparksHeal")

script.Parent.Handle.Touched:Connect(function(hit)
	
	local CarHumanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid", true) or hit.Parent.Parent:FindFirstChildWhichIsA("Humanoid", true) -- further searching purposes

	if CarHumanoid then
		
		CarHumanoid.Health = CarHumanoid.Health + 1 -- addition precaution instead of using +=
		SparksHeal.Enabled = true
		
	end
	
	SparksHeal.Enabled = false
end)

I’ve tried it, but it’s the same symptom

I think it would be nice to think that the car itself is humanoid npc

Can you explain in more detail the way you said it?

Player selects the car to be Healed by using a Prompt or something you prefer that spawns on the car when player is holding the Tool, and then on Tool.Activate regen the car’s Health