Humanoid take more damage afther heals health

Hello develupers I maked a medkit tool that heals 25 but afther heals. If you go on damage block it will take more damage than normal.
Look the damage taken before and after healing
The video don’t uploaded for me probaly you need to download it Sorry. And after you need to look into archives.
robloxapp-20211214-0928050.wmv (2.4 MB)

Script of damage brick


And script of medkit

Thanks for your suport.

I think its the findFirstchild???

1 Like

Tag your Humanoid with an attribute saying it’s been healed with a medkit

Humanoid:SetAttribute("HealedWithMedkit", true)

You can then put it into an if condition so that you take more damage next time the humanoid is hit

if Humanoid:GetAttribute("HealedWithMedkit") then
  ...
end
1 Like

Oh I will try to make it. Thanks

I think is not. The find first child

you should look into using a debounce on the damage script

basically the code is running more then once so it does more damage

I also recommended using Connect instead of connect and FindFirstChild instead of findFirstChild

1 Like

But how form I will put in this script

Is the script for the medkit a local script?

If it’s local script then, the server will not notice that the player health is gaining.

1 Like

Yes is a local script (ignore this words)is for minimum letters I can put

well that’s why I gave you a link, it explains everything

local waitTime = 0.5
local debounce = true

function onTouched(hit)
    local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")

    if humanoid and debounce then
        debounce = false

        humanoid:TakeDamage(1)

        task.wait(waitTime)
        debounce = true
    end
end

script.Parent.Touched:Connect(onTouched)
1 Like

You wold I put this localscript in a script?

Okay thank for all your help I will try all of your solutions

You should use RemoteEvent to update the humanoid health on server side.

I will try it thanks for your help.

Oh sorry I hadn’t seen the link