How would I make a cooldown after a certain time passed?

OH no remove the debounce :\ sorry I didn’t notice it. Only cooldown should be there.

userInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E and cooldown == false

like that right

userInputService.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E and cooldown == true then
		holdingKey = false
		
		if holdingTime >= timeToHoldThatKey then
			print("they held the key for 5 or more seconds")
		end
		
		wait(cooldownTime)
		
		cooldown = false
	end
end)

Thank you for your time, this solution worked out well at the end, i appreciate your time and effort with me, now since my brain is pooped right now I am going to study this script for future references thank you!

1 Like

Can you mark it as a solution so people know where to go for future reference? Oh and UserInputService | Documentation - Roblox Creator Hub

1 Like

yes im pretty sure i marked it as solution

1 Like

Yeah I didn’t see it at first because it doesn’t update on the current page.

1 Like