Block debounce working bad

Help with cooldowns for block attack
this happens.

	elseif inp.KeyCode == Enum.KeyCode.V and DB == false and BlockDB == false then
		print("pressed for block")
		DB = true
		BlockDB = true
		rem:FireServer(nil,"Block")
	end	
end)

uis.InputEnded:Connect(function(inp,pro)
	if pro then return end
	if inp.KeyCode == Enum.KeyCode.V and DB == true and BlockDB == true then
		print("pressed for unblock")
		wait(0.2)
		rem:FireServer(nil,"Block")
		DB = false
		BlockDB = false
	end
end)
1 Like

change it to

	if inp.KeyCode == Enum.KeyCode.V and DB == true and BlockDB == true then
		print("pressed for unblock")
		rem:FireServer(nil,"Block")
		wait(0.2)
		DB = false
		BlockDB = false

You put the remote event after the 0.2 wait
Maybe it helps not sure, i dont have much info to work around with

nope, its more spammable

Can you show the remote event please?

elseif mode == "Block" then
		if Blocking == false and BlockDB == false and DB == false then
			BlockDB = true
			DB = true
			Blocking = true
			Block(char)
		elseif Blocking == true and BlockDB == true and DB == true then
			BlockDB = false
			DB = false
			Blocking = false
			wait(0.2)
			UnBlock(char)
		end
	end

is blockDB a boolValue inside the player?

its not instance (30 chaaarssss)

every value its not instance. 30 charssss

you make cooldown 0.2, change wait(0.2) to wait(your cooldown number)

Try keeping your old script but changing this in the event script:

elseif Blocking == true and BlockDB == true and DB == true then
   wait(0.2)
   BlockDB = false
   DB = false
   Blocking = false
   UnBlock(char)
end

still spammable (30 charss omg)

btw rem:FireServer(nil,“Block”) whats the “nil” for?

ignore it. its just placeholder

Idk then i have no idea, sorry

Wait so when you press the key it fires the remote and plays the animation and you don’t people to be able to spam it right?

yes (30 charssssssssssssssssssssss)

So the problem is the cool down is only for firing the remote, it has nothing to do with the animation or any of that. so try creating a bool instance and resetting the cool down on the other script after the animation finishes. you probably have to put a wait after the animation for however long it goes for.

2 Likes

wdym. Creating bool on studio or by script.

A bool instance in the player so it is unique to each of them.

oh oh oh
ok will try do it. (i hate 30 charsss)