Hey, I made a tool that has a cooldown after you used it, I fixed the Cooldown line several times and It didn’t work, any help?
local Cooldown = 60
local CooldownDisplay = 60
local OnCooldown = false
local Tool = script.Parent
local ReplicatedStorage = game.ReplicatedStorage
local PickleProperty = ReplicatedStorage.ItemFolder.AnimationProperty.JarOPickle.Pickle:Clone()
local TopProperty = ReplicatedStorage.ItemFolder.AnimationProperty.JarOPickle.Top:Clone()
local AnimationFolder = Tool.Animations
local SoundFolder = Tool.Sound
local Animator = Tool.Parent.Humanoid.Animator
local Humanoid = Tool.Parent.Humanoid
local EatingTrack = Animator:LoadAnimation(AnimationFolder.Eat)
local HealedSound = SoundFolder.Healed
local EatingSound = SoundFolder.Eating
local LidOpeningSound = SoundFolder.LidOpening
script.Parent.Activated:Connect(function()
if OnCooldown then return end
OnCooldown = true
EatingTrack:Play()
EatingTrack.Stopped:Wait()
HealedSound:Play()
Humanoid.Health += 30
if EatingTrack.TimePosition == "0:17" then
LidOpeningSound:Play()
local TopWeld = Instance.new("Weld")
TopWeld.Part0 = Tool.Parent["Left Arm"]
TopWeld.Part1 = TopProperty
TopProperty.Parent = Tool.Parent["Left Arm"]
TopProperty.Position = UDim2.new(492.702, 72.8, -149.77)
TopProperty.Orientation = UDim2.new(-90, 0, 0)
end
if EatingTrack.TimePosition == "1:18" then
local PickleWeld = Instance.new("Weld")
PickleWeld.Part0 = Tool.Parent["Left Arm"]
PickleWeld.Part1 = PickleProperty
PickleProperty.Parent = Tool.Parent["Left Arm"]
PickleProperty.Position = UDim2.new(492.681, 72.968, -150.182)
PickleProperty.Orientation = UDim2.new()
end
if EatingTrack.TimePosition == "2:00" then
EatingSound:Play()
end
if EatingTrack.TimePosition == "2:06" then
EatingSound:Play()
end
if EatingTrack.TimePosition == "2:12" then
EatingSound:Play()
end
for i = CooldownDisplay, 1, - 1 do
Tool.ToolTip = "On Cooldown: "..i.."s"
end
wait(Cooldown)
OnCooldown = false
Tool.ToolTip = "I hate pickles, but this one regenerate your hp soo"
CooldownDisplay = 60
end)