I’m having problems with a cooldown for m1s. If you use an autoclicker while spamming “F” really fast (F is to block) it glitches out and the m1s stop working. It normally works fine but I discovered with an autoclicker it starts breaking.
Video:
Here is the client code:
uis.InputBegan:Connect(function(input, typing)
if toolEquipped == false or movesDisabled == true or stunned == true or humanoid.Health <1 or character:GetAttribute("SkillTree") == true then return end
if typing then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if m1Cooldown == true then return end
local moveString = "M1"
changeCombo()
local loadAnim = loadAnim(character.Humanoid, animations[m1Combo], 0.15)
movesDisabled = true
m1Cooldown = true
remoteEvent:FireServer(code, moveString, m1Combo)
local disconnectFunc = remoteEvent.OnClientEvent:Connect(function(returnString)
if returnString == moveString then
movesDisabled = false
spawn(function()
if m1Combo == 5 then
spawn(function()
cooldownModule.spawnCooldown(player, 2, "M1s")
end)
wait(2)
m1Cooldown = false
else
m1Cooldown = false
end
end)
end
end)
spawn(function()
while true do
if movesDisabled == false then
disconnectFunc:Disconnect()
break
end
wait()
end
end)
end
if input.KeyCode == Enum.KeyCode.F then
if blockCooldown == true then return end
local moveString = "Block"
local loadAnim = loadAnim(character.Humanoid, animations.Block, 0.15)
movesDisabled = true
blockCooldown = true
remoteEvent:FireServer(code, moveString, true)
local disconnectFunc = uis.InputEnded:Connect(function(_input, _typing)
if _typing then return end
if _input.KeyCode == Enum.KeyCode.F then
movesDisabled = false
remoteEvent:FireServer(code, moveString, false)
loadAnim:Stop()
spawn(function()
cooldownModule.spawnCooldown(player, 2, "Block")
end)
delay(2, function()
blockCooldown = false
end)
end
end)
spawn(function()
while true do
if blockBroken == true then
disconnectFunc:Disconnect()
movesDisabled = false
remoteEvent:FireServer(code, moveString, false)
loadAnim:Stop()
delay(2, function()
blockCooldown = false
end)
break
end
if movesDisabled == false then
disconnectFunc:Disconnect()
break
end
wait()
end
end)
end
end)
Another problem:
Also, something is up with the animations. They play weirdly now. They used to link perfectly but now they kind of override each other. I tried changing their priority and it made it slightly better but hasn’t fixed it.
Thanks.
PS: My code is kinda horrible, I’m not a very good scripter.