Simultaneous Hits Problem

Hm maybe i put the debounce somewhere i shouldnt have put it

edit : hold on let me try to move the debounce around

@tarneks
Yeah for some reason its not working because its just firing at the same time too fast so the debounce isnt even helping

Maybe you could add a:

wait(math.random(2,15)/10)

That way it will wait a random amount of time so both events won’t be in sync and the debounce will work.

Could you send your code please? It could really help me out understanding what the issue might be.

Yeah I wish that would work but the thing is that when I hit both the rocks when there close enough it registers as basically one debounce not two so it doesnt even have time too cooldown if that makes sense

Thats why I would a random wait, so that the two events would wait different amounts and one event would set the debounce to true before the other event is finished waiting.

Yeah I just told you that it reigsters as one because when I hit its so fasst

Can you please send your code? I don’t understand why you don’t want to send the code. It would make this so much easier so I could know whats actually happening.

2 Likes

code

local Rock = script.Parent 
local Torso = player.Character.Torso

Bindable.Event:Connect(function()
	if (Torso.Position - Rock.Position) < 7 then
		Rock.Health - 2
	end
end)
local Rock = script.Parent 
local Torso = player.Character.Torso
local Debounce = false

Bindable.Event:Connect(function()
	if (Torso.Position - Rock.Position).magnitude < 7 and Debounce==false then
                Debounce=true
		Rock.Health - 2
                wait(1)
                Debounce=false
	end
end)

yeah i tried that already that; it didnt work

you also forget the .magnitude

(Torso.Position - Rock.Position).magnitude < 7

yeah that wasnt even the problem ;-;

That won’t work because he has multiple scripts (1 for each rock), so the other scripts won’t see the debounce. You need to put a bool value into the player when they join, and then the scripts can change that value.

Then he should do what I said earlier, put a debounce in the rock

I have some ideas I’ll try to fix it

Alright thanks get back to me with anything

Change the Rock.Health - 2 into:
Rock.Health -= 2

This code looks like it should work perfectly, so I’m very confused.

But that isnt even the problem

Well it wouldn’t even work without it, Rock.Health-2 doesnt set the value, it just subtracts and does nothing else