Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I bind a mobile button to the left mouse button?

Asked by 4 years ago
Edited 4 years ago

I want to press the mobile button and it press the left mouse button. I have no clue how to do that or if it's even possible as I'm really new to scripting. This is what I have right now

local contextActionService = game:GetService("ContextActionService") function onButtonPress()

end

local mobilebutton = contextActionService:BindAction("ShootButton",onButtonPress,true,"MouseButton1") contextActionService:SetPosition("ShootButton",UDim2.new(0.72,-25,0.20,-25))

1 answer

Log in to vote
0
Answered by
Lakodex 711 Moderation Voter
4 years ago

Its possible. I would love to ask though why do you need this? Tapping on the screen is left mouse button already. If you want it that way though here you go

contextActionService:BindAction("ShootButton",onButtonPress,true,"MouseButton1Click") --This should work.
Ad

Answer this question