1 | -- loadstring(game:HttpGet("https://pastecode.dev/raw/7cojds9c/paste1.txt"))() |
2 | |
3 | local toolName = "Heal" |
4 | local maxHealth = 100 |
5 | local healthThreshold = 19.999 |
6 | |
7 | local player = game.Players.LocalPlayer |
8 | local backpack = player.Backpack |
9 | |
10 | local function equipAndUseHealTool() |
11 | local tool = backpack:FindFirstChild(toolName) |
12 | if tool then |
13 | player.Character.Humanoid:EquipTool(tool) |
14 | wait() |
15 | tool:Activate() |
16 | |
17 | -- Delay for a short period to allow the healing to finish |
18 | wait(0.0000001) |
19 | |
20 | -- Check if the player is still holding the tool after healing |
21 | if player.Character:FindFirstChild(toolName) then |
22 | local sword = backpack:FindFirstChild("Sword") |
23 | if sword then |
24 | player.Character.Humanoid:EquipTool(sword) |
25 | end |
26 | end |
27 | end |
28 | end |
29 | |
30 | local function onCharacterAdded(character) |
31 | character.Humanoid.HealthChanged:Connect(function(health) |
32 | if health <= healthThreshold and health > 0 then |
33 | equipAndUseHealTool() |
34 | end |
35 | end) |
36 | end |
37 | |
38 | player.CharacterAdded:Connect(onCharacterAdded) |
39 | |
40 | if player.Character then |
41 | onCharacterAdded(player.Character) |
42 | end |