How to make healing tool

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a flashlight tool that can heal a player
  2. What is the issue? Include screenshots / videos if possible!
    I tried using the touch event, but the touch event keep firing every time both objects moved, I want to heal the player when the player is stay inside the light, so I use a cone as fake light

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried using zoneplus module but it seems doesn’t to work when the part is inside a tool
    ZonePlus v3.2.0 | Construct dynamic zones and effectively determine players and parts within their boundaries - #488 by petrisgg
1 Like

you can use a table to store parts of player

local total = {}
local healplayer = nil

FakeLight.Touched:Connect(function(v)
	if v.Parent:FindFirstChild("Humanoid") then
		table.insert(total,v)
		healplayer = v.Parent
	end
end)
FakeLight.TouchEnded:Connect(function(v)
	if v.Parent:FindFirstChild("Humanoid") then
		table.remove(total,table.find(total,v))
		healplayer = nil
		for i,b in pairs(total) do
			if b.Parent == v.Parent then
				healplayer = v.Parent
			end
		end
	end
end)
1 Like

thank you its works very well :grinning:

no problem, it works too with button with many items