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

How to make a double click for a tool?

I need help with my activiation for a tool. Like when the tool is "double clicked" or like activated twice fast it will do something else than activating something twice. Help? Functions Please!

1 answer

✓ Accepted answer

Sorry I cant really explain This but i found out this method on accident hopefully the script is easy to understand, so place a local script in starter gui/starter pack, the script mostly consists of variables so it shouldnt be hard to understand the script:

local player = game.Players.LocalPlayer
   local mouse = player:GetMouse()

local B1 = false
 
  local doubleclicked = false
   
     local B2 = false

 local NEXTB = false

mouse.Button1Down:Connect(function()
	if NEXTB == false then
		B1 = true
	wait(0.1)
	B1	= false
	  NEXTB = true
	print("CMON")
	wait(0.05)-- how long you want the script to wait before clicking the button again and defining it as a double click,
	 NEXTB = false
	print("Aww no double click")
	
	end

end)
mouse.Button1Down:Connect(function()
 if NEXTB == true then
	   doubleclicked = true 
	wait(0.1)
	doubleclicked = false
	-- your function
			print("Player Has Double Clicked")
		end
end)

3 comments

0

Worth a shot

0

HOLY MOLY IT WORKED, Thank you!

0

np!

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