ElementsControls
AddCooldownButton
Adds an action button that temporarily locks itself after activation.
AddCooldownButton
What it does
Adds an action button that temporarily locks itself after activation.
When to use it
Use it to prevent rapid repeats for rate-limited actions, teleports, network calls, or expensive operations.
ElementFunction:AddCooldownButton(CooldownConfig)
local ServerActionCooldown = LeftGroup:AddCooldownButton({
Name = "Refresh Server Data",
Description = "Prevents repeated requests while data refreshes.",
ButtonText = "Refresh",
CooldownText = "Ready in",
Duration = 5,
Callback = function()
RuntimeMonitor:Refresh()
RefreshPlayerDataTable()
Library:MakeToast({Title="Server data",Content="Runtime and player data refreshed.",Variant="Success",Icon="refresh",Time=2})
end
})Behavior and return value
Call this method on the compatible section, tab, panel, or element container shown by the signature. Store the returned value when you need to update, read, or destroy the element later.
Fields marked optional may be omitted. XLQP then uses the method’s built-in default or leaves that feature disabled.