Add Shield Function when tool activated?

Hi everyone I’m currently working on a Tool Abilty System and rn I want that if I activate a tool I shouldn’t get damage for 5 seconds and it should habe a cooldown of 10 seconds I tried getting help on other platforms like YouTube and chat gpt but …

you could try to document the player’s hp and then set the player’s hp to the documented hp for 5 seconds

Going off of what @bensonweng12345 said, you can just use a numberValue to capture the health of the player.

Ex:

local Humanoid = nil---define the player's humanoid
local healthValue = script.HealthValue :: NumberValue 
healthValue.Value = Humanoid.Health
task.wait(5)

if Humanoid.Health >= healthValue.Value then
	--- equip shield
end
local Cooldown = false
local IsActive = false

Tool.Activated:Connect(function()
   if Cooldown == false then
       Cooldown = true
       IsActive = true
       wait(5)
       IsActive = false
       wait(5)
       Cooldown = false       
   end
end)

Then just make the player not take damage when IsActive is true.