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

I will not print when the tool is clicked 2 times?

when the tool is activated and click 2 times, I want it to print the stuff I want it to but it won't work

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local starterPack = game:GetService("StarterPack")
local tool = starterPack:WaitForChild("Tool")
if tool then
	tool.Activated:Connect(function(activated)
		if mouse.MouseButton1Click == 2 then
			print("clicked 2 times")
		end
	end)
end

2 answers

✓ Accepted answer

You should use an amount of clicks variable that counts the clicks.

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local starterPack = game:GetService("StarterPack")
local tool = starterPack:WaitForChild("Tool")
clicks = 0
if tool then
    tool.Activated:Connect(function(activated)
        if mouse.Button1Down then
            clicks = clicks + 1
        end
	if clicks == 2 then
	    print("Clicked two times.")
	    clicks = 0
	end
    end)
end

5 comments

0

It's a small adjustment, but i believe this will work efficiently.

0

@KDarren12 it gave me the error 08:56:55.375 - MouseButton1Click is not a valid member of PlayerMouse

0

OH, you can't get a MouseButton1Click from Player's mouse.

0

Let me edit it real quick

0

All you needed to change was "MouseButton1Click" to "Button1Down"

Activated is ran whenever you click , use a variable that can be increased to see when they click twice

1 comment

0

just answered based on your answer

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