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

I can use Button2Down just fine, but not Button2Up. Help?

First if statement works, not the second.

local uis = game:GetService("UserInputService")

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

uis.InputBegan:Connect(function(Start,End)
	if mouse.Button2Down then
		print("mouse.Button2Down worked")
	elseif mouse.Button2Up then
		print("mouse.Button2Up worked")
	end
end)

1 answer

This is because UserInputService is not the same as Mouse, the way I would do this is like this:

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


mouse.Button2Down:Connect(function() -- function fires when your right mouse button is clicked down
	print("mouse.Button2Down worked")
end)

mouse.Button2Up:Connect(function() -- function fires when your right mouse button is released
	print("mouse.Button2Up worked")
end)

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