Instead of doing a cooldown, it prints "Pressed e" as soon as I press it with no cooldown between presses, then all the "yes"s come in 5 seconds later.
local debounce = false
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
if debounce == false then
debounce = true --Now your code will not run, because debounce is not false.
mouse.KeyDown:connect(function(key)
if key == "e" then
print("Pressed e")
wait(5)
print("yes")
debounce = false --Now your code will run again.
end
end)
end

1 comment
EDIT: combined line 5 and 6 to "if not debounce and key == "e" then" just because it looks better and is more efficient.