If you want to make a cooldown, you could do this, if you want to make it only usable one time per player, you could do this: local cooldowns = {}
local cooldownTime = 30
local function onActivated(mouse)
local player = game.Players:GetPlayerFromCharacter(mouse.Parent)
if cooldowns[player] and cooldowns[player] > tick() then
print(“Cooldown not ready”)
return
end
cooldowns[player] = tick() + cooldownTime
print(“Activated”)
end
script.Parent.Activated:Connect(onActivated)
If you want to make it so it is only usable X amount of times per player, you could do this: local cooldowns = {}
local cooldownTime = 30
local maxCooldowns = 3
local function onActivated(mouse)
if cooldowns[player] and cooldowns[player] > maxCooldowns then
print(“Cooldown not ready”)
return
end
cooldowns[player] = cooldowns[player] + 1
delay(cooldownTime, function()
cooldowns[player] = cooldowns[player] - 1
end)
print(“Activated”)
end