So i have a move which fires with an animation and works perfectly,the only problem is i can't manage to put an cooldown on it.Here's the script:
local cf = script.CanFire
cf = true
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
local disappear = .6
local damage = 50
local key = 'q'
local speed = 500
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
plr = script.Parent.Parent.Parent
chr = plr.Character
hum = chr.Humanoid
if cf == true then
Player = game.Players.LocalPlayer
Character = Player.Character
Mouse = Player:GetMouse()
function onKeyDown(keyx)
if keyx == key:lower() then
local ffa = hum:LoadAnimation(script.FFA)
ffa:Play()
wait(1)
local x = Instance.new("Part")
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
x.Shape = "Ball"
x.Transparency = 1
x.Size = game.ReplicatedStorage.x1.Size
game.Debris:AddItem(x, disappear)
x.BrickColor = BrickColor.new("Bright red")
local f = Instance.new("ParticleEmitter")
f.Parent = x
f.Texture = "rbxassetid://410256160"
f.Rate = 300
f.Size = game.ReplicatedStorage.Meraf.Size
local y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
y.velocity = Character.Torso.CFrame.lookVector*speed
y.Parent = x
x.Parent = workspace
x.CFrame = Character.Torso.CFrame*CFrame.new(0, 0, -12)
x.Touched:connect(function(Part)
if Part.Parent:findFirstChild("Humanoid") and Part.Parent.Name ~= Player.Name then
Part.Parent.Humanoid:TakeDamage(damage)
x:Destroy()
cf = false
wait(3)
cf = true
end
end)
end
end
Mouse.KeyDown:connect(onKeyDown)
end

2 comments
you need to use cf.Value to set cf's value.
i did that but it still didn't work