Загрузка данных


local tool = script.Parent

local HEAL_AMOUNT = 25
local COOLDOWN = 2
local MAX_USES = 3 -- сколько раз можно использовать бинты

local onCooldown = false
local usesLeft = MAX_USES

tool.Activated:Connect(function()
	if onCooldown then return end
	if usesLeft <= 0 then return end

	local character = tool.Parent
	if not character then return end

	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if not humanoid then return end
	if humanoid.Health <= 0 then return end
	if humanoid.Health >= humanoid.MaxHealth then return end

	onCooldown = true
	usesLeft -= 1

	humanoid.Health = math.min(humanoid.Health + HEAL_AMOUNT, humanoid.MaxHealth)

	-- если бинты закончились, удаляем tool
	if usesLeft <= 0 then
		task.wait(0.1)
		tool:Destroy()
	else
		task.delay(COOLDOWN, function()
			onCooldown = false
		end)
	end
end)