I watched a tutorial on how to make a medkit, and it worked but there is no cooldown, so you can just spam it.
I’ve tried to make one with TouchInterest but i can’t put one in a Tool or Part.
(if the image doesn’t load here’s the script)
local tool = script.Parent
tool.Activated:Connect(function()
local humanoid = tool.Parent:FindFirstChild(“Humanoid”)
humanoid.Health = humanoid.Health + 35
Format you code using ```
In this case you would want to use a debounce
local tool = script.Parent
local CoolingDown = false -- The debounce variable
tool.Activated:Connect(function()
If not CoolingDown then
CoolingDown = true
local humanoid = tool.Parent:FindFirstChild(“Humanoid”)
humanoid.Health = humanoid.Health + 35
wait(3) -- After 3 seconds cooldown is finished
CoolingDown = false
end
end)
local tool = script.Parent
local cooldowndeb = false
tool.Activated:Connect(function()
if cooldowndeb then return end
cooldowndeb = true
local humanoid = tool.Parent:FindFirstChild("Humanoid")
humanoid.Health += 35
wait(1) --Or how long you want
cooldowndeb = false
end)
Basically how @amadeupworld2 did it but I just used guard clauses and simpler operation, such as using humanoid.Health += 35 instead of humanoid.Health = humanoid.Health + 35 statements to make it look simpler