#Controller support

1 messages · Page 1 of 1 (latest)

regal basin
#

I have a script that requires some keys on the controller, for example, I use a code that requires the R2 key, and another function that works with mouse button 1, when R2 is used, my mouse button 1 function occurs, how can I change that?

Example:

local uis = game:GetService("UserInputService")

uis.InputBegan:Connect(function(a, b)
if b then return end

if a.KeyCode == Enum.KeyCode.ButtonL2 then
print("a")
elseif a.UserInputType == Enum.UserInputType.MouseButton1 then
print("b")
end
end)

Output: a (x2) -- I pressed m1 and r2

sand current
#

Try checking the input.Device

if input.UserInputType == Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Gamepad1 then