Since TeleportPlayer is what is called when the player makes the command, it’s in this function you’ll need to add the cooldown/debounce.
local debounce = false
function TeleportPlayer()
-- First, check if we're on cooldown (debounce active).
-- If it is, we use return to exit before doing anything.
if debounce then return end
-- At this point, we're off cooldown (debounce inactive).
-- We go on cooldown by activating the debounce.
debounce = true
-- It's at this point your teleport is performed.
-- I will omit this for brevity.
-- ...
-- ...
-- Afterwards, go back off cooldown by deactivating the debounce.
-- Make sure you don't return from your function before doing this,
-- otherwise you'll stay on cooldown forever.
debounce = false
end
No, you’d need to surround everything in your teleport operation with the debounce check and set. As in, before fading out, you need to have checked and set the debounce. After fading back in is when you’d unset the debounce.
I can’t help you with an error you haven’t posted about.
Something tells me you’re not using the Output window to check errors because wait(0,1) ought to be wait(0.1). Perhaps you should read Debugging Tools on the devhub.
wait(0,1) is correct syntax but is not correct semantically. It is the same as wait(0), which doesn’t do what you think it does (it waits 1/30th of a second, about 0.03s, or close to it). A comma cannot be used in place of a period when specifying numbers. Here, it is permissible because it is interpret as sending two parameters, 0 and 1, to wait. Wait only takes 0 or 1 parameters.
Back on topic…
Your original code has the following line:
TeleportButton.FontSize "Size24"
You probably meant this to be an assignment of the FontSize property of TeleportButton. Due to the missing =, Lua thinks you want to call a FontSize function with “Size24” as the only argument (that’s where the error comes from). The property is also deprecated, and you should be using TextSize instead.
I think your problem is when your setting the font size setting, your using the enum instead of the property value. Look Here for a table of font sizes. The first colum is for enums, the second is for setting the properties.