Suggestions Cooldown

Hi!!
So, I made a suggestions button for my game which links to a channel in my discord server. But I have no idea how to even start creating a cooldown so people don’t spam the suggestions and also no idea how to make the text change so it says when it was submitted.
I’m not asking for scripts if you don’t want to-- and i dont know if this even counts as worthy for a topic, but till I find a solution, please dont flag it :,D

Anyways, I tried a script for the cooldown thing, but I don’t think it makes any sense- bare in mind im new at scripting so obviously I don’t know a lot of stuff

script:

--script.Parent.MouseButton1Click:Connect(function()
wait (0.5)
SubmitButton.Text = "Submitted!"
wait(4)
SubmitButton.Text = "Submit"
wait (5)

end)


I have no idea how to make a cooldown, where to start, and the submit to submitting won’t work, so if someone could kindly help out by either correcting the script or linking me to a tutorial that could help (I can’t find any) that’d be appreciated :,D also try not to be mean- i’m really new at this stuff-

Hey there! Debounces will be your best friend in this type of situation.

Debounces can be used for cooldowns and preventing code from running too many times.

local Debounce = false

script.Parent.MouseButton1Click:Connect(function()
   if not Debounce then -- Checks if the debounce (cooldown) is not active
        Debounce = true -- Enables the debounce (cooldown)
        wait(0.5)
        SubmitButton.Text = "Submitted!"
        wait(4)
        SubmitButton.Text = "Submit"
        wait(5)
        Debounce = false -- Disables the debounce (cooldown)
    end
end)

I hope this helps and if you need more information on debounces you should consider looking here:
https://developer.roblox.com/en-us/articles/Debounce

Do I put it in the submit button?

Yes but you might aswell change the SubmitButton text inside the script to Script.Parent.