Trying to detect RMB input, LMB input is detected when I press the RMB.
On below image, I pressed the RMB 4 times. It outputs as LMB (MB1)
My goal for this post is to:
A. Figure out if I am doing something wrong.
B. Figure out if this is a roblox bug.
C. Hardware error?
If you have any information on why this is happening, please help out!
Thanks!
Code Below:
-- Ui toggle & mode enable / disable
buildModeEnabled = true
nonInputs_folder:WaitForChild("CoreGui").Value.Enabled = buildModeEnabled
-- Get mouse inputs while build mode is enabled
local mouse = local_plr:GetMouse()
-- Editing objects input
local startClick = nil
local allowEdit = nil
local connected_Buildmode1 = UIS.InputBegan:Connect(function(input)
startClick = os.clock()
while allowEdit == nil do
task.wait()
end
if allowEdit == true then
allowEdit = nil
elseif allowEdit == false then
allowEdit = nil
return
end
warn(input.UserInputType == Enum.UserInputType.MouseButton2, input.UserInputType)
if input.UserInputType == Enum.UserInputType.MouseButton2 then -- Editing / Selecting parts
local hit = mouse.Target
if hit then
if hit.Parent.Parent.Name == "Objects" then
-- Below put functions for UI input and keybind input for editing objects
local function select_new_object()
if old_box then old_box:Destroy() end
local box = Instance.new("SelectionBox")
box.Adornee = hit
box.Parent = hit
box.Color3 = Color3.fromRGB(0, 170, 255)
nonInputs_folder:WaitForChild("EditMenu").Value.Enabled = true
old_box = box
end
select_new_object()
end
end
end
end)
-- why does below exist?
-- no event for click, so I will detect a click myself (click would be mouse down then up right after)
local connected_Buildmode2 = UIS.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton2 then
local delta = os.clock() - startClick
if delta < 0.5 then
allowEdit = true
else
allowEdit = false
end
end
end)