✓ Accepted answer
You should use simple debounce, a value that will be set to false whenever you heal yourself and then be set back to true after your desired time, in your case it would look like this
local tool = script.Parent
local DebounceTime = 5
local debounce = false
tool.Activated:Connect(function()
if (debounce) then
return
end
local humanoid = tool.Parent.Humanoid
humanoid.Health += 15
debounce = true
wait(DebounceTime)
debounce = false
end)
You can remove FindFirstChild on Humanoid there too, it serves no much purpose.
The one problem is that any exploiter can remove the debounce, that's why i suggest you firing remote event to the server for it to heal the player and implement the debounce on the server, if you are just learning something, it is not necessary but in real games it can sometimes be bad.
1 comment
It works thank you so much for helping me!!!