#How could I add a right click or left click to my game on controller?
1 messages · Page 1 of 1 (latest)
@agile flame context action service
would you mind elaborating?
yea wait so you want an alternative to pc "leftclick/rightclick" to a console controller right?
@agile flame
like for example i have a tool in my hotbar which i have to left click first (which works) but to activate it i need to right click after warss
yes
u using userinputservice rn?
i managed to find a script with userinputservice but nothings really woring
i tried controller emulator too
context action service lets you bind actions to keys and buttons
my keybind “F” is the 2nd trigger to the tool i am using and i tried putting L2 as my “F” but nothings happened
"Context Action Service in Roblox is a useful tool for cross-platform support. It can bind one function to multiple key binds from different platforms."
there
its like alternative to UIS
you mind dumbing it down sorry
is it more reliable than the UIS?
if so how could I do it yeah
yknow how mobile games have those buttons?
yes
yea its by context action service
so basically you just make a function
for example attack function
and you use BindAction to make like for example Keycode.LeftClick, Mobilebutton, or even controller buttons
so those 3 inputs do the same "Attack" action
you call this "BindAction(actionName: string,functionToBind: function,createTouchButton: boolean,inputTypes: Tuple):()"
(it automatically creates a mobile button for you)
not sure how to do it with controller yet, but i know it can
holy okayyy
it may js be the system im using doesnt supoortt the keybinds of a controller
but certain thatd not the problem
thats
-- 1. The Function that runs when the button is pressed
local function onAttack(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
print("Flash Punch triggered via: " .. inputObject.KeyCode.Name)
-- Call your attack function here!
end
end
-- 2. Bind the action
-- Arguments: ("Name", function, createMobileButton, Key1, Key2, Key3)
CAS:BindAction("SpeedPunch", onAttack, true, Enum.KeyCode.F, Enum.KeyCode.ButtonX) ```