How would I add a cooldown to this textbutton script, so that people won't be able to spam it and glitch the button?
local original = script.Parent.Text
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
if player.leaderstats.Points.Value >= 50 then
print("found leaderstats and firing server")
game.ReplicatedStorage.TeleportEvent:FireServer(player)
script.Parent.Text = "Teleported!"
wait(1)
script.Parent.Text = original
else
script.Parent.Text = "Not enough Points"
wait(2)
script.Parent.Text = original
end
end)
