Add data changing cooldown system?

In my game, I use a main module that stores the data of all players that are currently in game, I was wondering if there is a way to make sort of a delay or cooldown that doesn’t completely exit the function but sort of delays the save so that they can’t just spam these kind of requests, or should I not worry about this at all?

Here’s what I tried currently:

local function changeData(player, category, value)
	if dataChangeCooldowns[player] then
		task.wait(1)

		dataChangeCooldowns[player] = false
	end
	
	if typeof(category) ~= "string" then
		return
	end
	if typeof(value) ~= "table" then
		return
	end
	
	local data = playerData[player.UserId]
	
	if data then
		if data[category] then
			if category == "keybinds" then
				playerData[category] = dataUtils:convertListToString(value)
			else
				playerData[player.UserId][category] = value
			end
		end
	end
	
	dataChangeCooldowns[player] = true
end
local lastTick = tick()
local cooldown = 1

-- some function 
if tick() - lastTick < cooldown then return end
lastTick = tick()