How to script chatted and damage on click together?

What am I trying to achieve?
I’m making a PVP system where the player needs to say a specific word and then click on an opposing player or hostile NPC within a limited time to result in damage. I have managed to script the chatted function (which fires animation and effect event) and click on the damage event separately.

My problem now is I don’t know how to combine the two scripts together, along with a limited time frame for the players to click on an opponent.

Script for firing animation and effects:

local RS = game:GetService("ReplicatedStorage")
local Animation = game.ReplicatedStorage.Animation.Ani
local Toggle = game.ReplicatedStorage.EffectToggle

local Player = game.Players.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait() 

    if message == "Fire" then

        local Humanoid = Character:WaitForChild("Humanoid")
        local Ani = Humanoid:LoadAnimation(Animation)

        Ani:Play() --Fires animation
        Toggle:FireServer() -- Fires particle event

Script for damage on click:

local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()

local RS = game:GetService("ReplicatedStorage")
local clickEvent = RS:WaitForChild("Dmg")

    local model = mouse.Target:FindFirstAncestorOfClass("Model")
    if model then
        local clickedPlayer = game.Players:GetPlayerFromCharacter(model)
        if clickedPlayer then
            clickEvent:FireServer(clickedPlayer) -- does damage

The combined process should be: Say “Fire” in chat → if, click on another player within a limited time (say 5 seconds) → then, fires animation, effects and damage → else, (if 5 seconds are up without clicking someone) End

I’ve tried using wait to create that timespan for players to click on an opponent but nothing has worked. It is possible I’m coding in the wrong sequence. I’ve heard of loops and clickdetectors but I’m not sure how, or if I should, include them in the script. Some mentoring and feedback would be appreciated. Thank you.

You could make a BoolValue that changes when the player chats the keyword and then check for the BoolValue in the mouse.Button1Down event. For time-delayed items I usually use something like this:

	for _, v in pairs(CollectionService:GetTagged("Objects")) do
		if tick() - v:GetAttribute("Time") >= MaxTime then
			v.Value = true