How to add a cooldown to a module script?

Just a simple question but is there a way to add a cooldown to this module script ability?
[UPDATE] I tried adding a cooldown that gets the number form the module scripts but i’m get this error

21:01:18.542 Players.Funnyskyswagway3.PlayerScripts.Keybinds:10: attempt to index nil with ‘Cooldown’ - Client - Keybinds:10

Local Script:

local GameFolder = game.ReplicatedStorage.GameFolder
local Modules = GameFolder.Modules
local PearlModule = require(Modules.PearlAbilities)
local Debounce = true

local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(hit, chat)
	if chat then return end
	local ActivateAbility = PearlModule[hit.KeyCode] 
	local Cooldown = ActivateAbility.Cooldown
	if ActivateAbility and Debounce == true then
		Debounce = false
		ActivateAbility.Activate()
		wait(Cooldown)
Debounce = true
	end
end)

Module Script:

local TweenService = game:GetService("TweenService")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Abilitys = {
	[Enum.KeyCode.Q] = {
		Activate = function()
			local Gem = Player.Character:WaitForChild("Gem")


			if Gem.Light.Brightness == 0 then
				Gem.Material = Enum.Material.Neon
				TweenService:Create(Gem.Light,TweenInfo.new(1), {Brightness = 10} ):Play() 

			else
				Gem.Material = Enum.Material.SmoothPlastic
				TweenService:Create(Gem.Light,TweenInfo.new(0.5), {Brightness = 0} ):Play()
			end
			
		end,
	}
	
}
return Abilitys

The error is just saying that the ActivateAbility variable in the localscript is nil, which means the pressed key doesn’t have a designed function in the module (it doesn’t exist).

You should add a check to see if the pressed key has a corresponding function first before doing anything with it.

	local ActivateAbility = PearlModule[hit.KeyCode] 
	if ActivateAbility then
		local Cooldown = ActivateAbility.Cooldown
		...

You do not have a cool down variable in the abilities table so the local script is is returning nil

local TweenService = game:GetService("TweenService")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Abilitys = {
	[Enum.KeyCode.Q] = {
		Activate = function()
			local Gem = Player.Character:WaitForChild("Gem")


			if Gem.Light.Brightness == 0 then
				Gem.Material = Enum.Material.Neon
				TweenService:Create(Gem.Light,TweenInfo.new(1), {Brightness = 10} ):Play() 

			else
				Gem.Material = Enum.Material.SmoothPlastic
				TweenService:Create(Gem.Light,TweenInfo.new(0.5), {Brightness = 0} ):Play()
			end

		end,
		
		Cooldown = 10
	}

}
return Abilitys