This is pretty long but I hope someone can help.

So I've made diamonds rain randomly from the sky, and when a player touches a diamond:

-The diamond is destroyed,

-the player who touched it gains 1 point in the leaderboard/leaderstats thing,

-and a text pops up on the screen that lasts 2 seconds and reads "+1 Diamond".

Everything works well, but when you touch a diamond and then touch another before the 2 seconds is over, the text will disappear when it reaches 2 seconds, instead of resetting from the second touch and waiting another 2. It does this because no matter what, after touching a diamond and after 2 seconds, the visibility of the text will be set to false.

I want to make it so that every time the player touches a diamond, the amount of time the text stays on the screen should reset to 2, interrupting the previous time.

Here are my scripts, this first one is a child of the diamond and is a Server Script:


countdown = 2
local diamond = script.Parent
local remote = game:GetService("ReplicatedStorage").DiamondDisplay

--When diamond is touched...
diamond.Touched:Connect(function(hit)
		local character = hit.Parent
		local humanoid = character:FindFirstChild("Humanoid")
			--Checks if is a humanoid
			if humanoid then
				local player = game.Players:GetPlayerFromCharacter(character)					
				wait(0.1)--don't want diamond to instantly disappear
				diamond:Destroy()
				--Adds 1 to player's leaderboard
				player.leaderstats.Diamonds.Value = player.leaderstats.Diamonds.Value + 1
				
				remote:FireClient(player, true)--makes text visible
				
				wait(countdown) --how long the text will stay visible for
				
				remote:FireClient(player, false)--makes text invisible
					
			end
	
end)

And this is in the StarterPlayerScripts(Local Script):

local remote = game:GetService("ReplicatedStorage"):WaitForChild("DiamondDisplay")
local player = game.Players.LocalPlayer

remote.OnClientEvent:Connect(function(toggle)
		
		player.PlayerGui.ScreenGui.DiamondAdd.Visible = toggle
		
end)

I've tried a lot of if-statements and even used global variables, but I can't think of how I can make it work.

I'd really appreciate it if someone could help me out, even though this is one of those questions.