I surely know how to make it but what I want is like a tool timer, like example:
Tool Name = Sword
You have used the tool, and the cooldown is 10 seconds, the name of the tool changes to how many seconds does the cooldown have, it’s like, the number decreases until it turns 0. And when after the 0, the tool name will be changed back into the name “sword”.
For short, all I want is a tool cooldown the shows up to the name of the tool.
You can put a while loop, get a delay variable that sets it to the delay you want, then it does -1 from the delay variable and then it sets the tool name to the delay variable. It would do this for how many seconds you want and when it reaches 0 you can set the tool name to sword. If you could send a code example so I can see your existing code, that would be great.
I’m not sure if you mean something like this but there you go:
local tool = script.Parent
local toolName = tool.Name
local cooldown = 10 -- seconds
for i = cooldown, 0, -1 do
task.wait(1)
tool.Name = toolName .. " (Cooldown: " .. i .. ")"
end
local cooldown = false -- Cooldown boolean
local maxTime = 5 -- Set your cooldown here
local cooldownTime = script.Parent:WaitForChild("CooldownTime") -- Number Value inside the tool
script.Parent.Activated:Connect(function() -- When the tool is activated
--[[ Do everything you want to do with the tool here before the cooldown]]
print("Tool was activated") -- Print
if cooldown then -- If the cooldown is active
print("Wait ".. cooldownTime.Value) -- Print
return -- Return
else -- If the cooldown isn't active
cooldown = true -- The cooldown will be active
script.Parent.CooldownTime.Value = maxTime -- Set the cooldown time to the max cooldown time
while cooldown do -- While the cooldown is active
if cooldownTime.Value == 0 then -- If the cooldown is over then
cooldown = false -- Set the cooldown to false
script.Parent.Name = "Sword" -- Set back the name
break -- Stop the loop just in case
else -- If the cooldown time is not 0
cooldownTime.Value = cooldownTime.Value - 1 -- Subtract 1
script.Parent.Name = cooldownTime.Value -- Set the name to the cooldown time
wait(1) -- Wait 1 second
end
end
end
end)