So, I have been trying to add a medic class into my roblox game. I decided that it would need a tool that would be able to heal teammates. I made the tool, (the entire tool is all in the part "Handle"). I put this script into my tool hoping it would make the tool heal any humanoid that touched the part. Here is the script:

local debounce = false
game.Players.LocalPlayer.Backpack.Healing.Handle.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if not debounce then
			debounce = true
				while hit.Parent.Humanoid.Health <100 do
					hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Heath + 25
					wait(5)
				end
				wait(5)
				debounce=false
		end
	end
end)

Personally, I am a new scripter and I think the proble may be about how I defined the tool. It all seemed right though.

The tool is called: Healing. The handle is called: Handle

Please tell me how to fix this code, Thanks!

4 comments

0

Here is what I tried to do to fix it...

0

local debounce = false script.Parent.Handle.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then if not debounce then debounce = true while hit.Parent.Humanoid.Health <100 do hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Heath + 25 wait(5) end wait(5) debounce=false end end end)

0

Are you intending for it to steadily heal the target until they're fully healed or do you want it to heal them every time they touch the part?

0

I want them to heal everytime they touch the part.