What do you want to achieve? Keep it simple and clear!
Making a gun and when I set the gun to Semi-fire, it shoots fine just like Semi-fire gun until I found out that the gun shoots fast when I spam click.
What solutions have you tried so far?
I use wait() statement even not working. I’m now clueless + I’m not an intermediate scripter.
Client code below
Weapon.Activated:Connect(function()
if not IsShooting then
IsShooting = true
if Automode.Value == true then -- If automode enabled then
repeat -- repeating the fire until the "IsShooting" turn into false
wait(AutoCoolDown)
firing()
until not IsShooting
else -- if not true then it fires just like semi gun
firing()-- FIRE
wait(SemiCoolDown)
end
end
end)
You may need to create another variable to create an activation cooldown, and just return the Activated event if the activation cooldown is set to true
local actCD = false
Weapon.Activated:Connect(function()
if not IsShooting then
IsShooting = true
if Automode.Value == true then -- If automode enabled then
repeat -- repeating the fire until the "IsShooting" turn into false
wait(AutoCoolDown)
firing()
until not IsShooting
else -- if not true then it fires just like semi gun
if actCD == true then
return
end
actCD = true
firing()-- FIRE
wait(SemiCoolDown)
actCD = false
end
end
end)