So I have binded a action which uses mousebutton1 and touch and I wanted to see what input I can get out of clicking a ImageButton
which I Had found out when you click or do any input on a imagebutton it completely ignores the binded contextactionservice
ContextActionService:BindAction('BeganInput', function(Name,InputState, Object) print(InputState) end, false, Enum.UserInputType.MouseButton1, Enum.UserInputType.Touch )
Heres an example
when I click an image it completely ignores this BindAction
and the BindAction does not fire at all
i see what your trying to do. Instead of using a button why not make a custom one using imageLabels
local ContextActionService = game:GetService("ContextActionService") local UserInputService = game:GetService("UserInputService") local ScreenGui = script.Parent local ImageLabel = ScreenGui.ImageLabel local MouseEnum = Enum.UserInputType.MouseButton1 local DebugFrame = ScreenGui:FindFirstChild("ImageButton") or Instance.new("ImageLabel",ScreenGui) DebugFrame.Active = false DebugFrame.AnchorPoint = Vector2.new(.5,.5) local MousePosition = UDim2.fromOffset(0,0) local MouseTrackName = "MouseTrackName" local function TrackMouse(Name,InputState, InputObject) if Name == MouseTrackName and InputState == Enum.UserInputState.Change then local MousePostion = UserInputService:GetMouseLocation() MousePosition = UDim2.fromOffset(MousePostion.X,MousePostion.Y) DebugFrame.Position = MousePosition end end ImageLabel.InputBegan:Connect(function(InputObject) if InputObject.UserInputType == MouseEnum or InputObject.UserInputType == Enum.UserInputType.Touch then ContextActionService:BindAction(MouseTrackName,TrackMouse,false,Enum.UserInputType.MouseMovement,Enum.UserInputType.Touch,MouseEnum) local MousePostion = UserInputService:GetMouseLocation() DebugFrame.Position = UDim2.fromOffset(MousePostion.X,MousePostion.Y) end end) ImageLabel.InputEnded:Connect(function(InputObject) if InputObject.UserInputType == MouseEnum or InputObject.UserInputType == Enum.UserInputType.Touch then ContextActionService:UnbindAction(MouseTrackName) end end)