Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is it possible to put only one debounce to 2 functions?

I want to put my Mouse.Button1Down and Mouse.Button1Up in only one debounce. I don't know if it's even possible and how.

script.Parent.Equipped:Connect(function(mouse)

	mouse.Button1Down:Connect(function()
			lunge:Play()
	end)

	mouse.Button1Up:Connect(function()
			lunge:Stop()
			slash:Play()
			wait(1)
			slash:Stop()
			
			script.Parent.Blade.Touched:Connect(function(hit)
				if CanDamage.Value == true then
					CanDamage.Value = false
					hit.Parent.Humanoid:TakeDamage(damage)
				end
			end)
	end)
end)

1 comment

0

Yes.

2 answers

✓ Accepted answer

I don't think this is possible, and even if it is, it is surely difficult to do. It is much easier and simpler to use two debounces:

local buttonUpDebounce, buttonDownDebounce = false, false

This doesn't answer your question, but you're hooking the Equipped event with the mouse parameter included, that's fine, but you're also trying to damage the humanoid on line 16. Either client-script or server-script, this won't work.

Server scripts can hook the Equipped event, but it doesn't include the mouse object. Client scripts can hook the Equipped event, but you cannot damage a Humanoid on the client and let it replicate- Unless FilteringEnabled is disabled, in which your game in vulnerable to exploits.

This discussion is preserved as it was. New answers, comments, and votes are closed.