Add CoolDown function to Platform Tool Maker?

Hi everyone I’m currently working on a Tool Ability System and rn I have a Tool that spawns a part when the Tool is activated with a Duration of 5 seconds but I can spam this that’s why I need a CoolDown and the Part spawns weirdly can u guys code it so it spawns where I click with my Mouse?
Here’s the LocalScript:

local tool = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local replicatedStorage = game:GetService("ReplicatedStorage")
local platformTemplate = replicatedStorage:WaitForChild("PlatformTemplate")

local function createPlatform()
	local character = player.Character or player.CharacterAdded:Wait()
	local platform = platformTemplate:Clone()
	platform.Position = character.HumanoidRootPart.Position + Vector3.new(0, 0, 0)  -- Adjust height as needed
	platform.Parent = workspace

	-- Platform disappears after a few seconds
	wait(5)  -- Change duration as needed
	platform:Destroy()
end

tool.Activated:Connect(createPlatform)
local tool = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local replicatedStorage = game:GetService("ReplicatedStorage")
local platformTemplate = replicatedStorage:WaitForChild("PlatformTemplate")

local debounce = false 
local debounceTime = 1 

local function createPlatform()
	if debounce then
		return
	end

	debounce = true 

	local character = player.Character or player.CharacterAdded:Wait()
	local platform = platformTemplate:Clone()
	platform.Position = character.HumanoidRootPart.Position + Vector3.new(0, 0, 0)  -- Adjust height as needed
	platform.Parent = workspace

	-- Platform disappears after a few seconds
	wait(5)  -- Change duration as needed
	platform:Destroy()

	wait(debounceTime) 
	debounce = false
end

tool.Activated:Connect(createPlatform)

I added a basic debounce system that prevents spamming the function