I've bound a function to my M1 like this:

-- Bind keys to contextactionservice
local ctx = game:GetService("ContextActionService");
-- M1
ctx:BindAction("attack", handleInput, true, Enum.UserInputType.MouseButton1);
ctx:SetTitle("attack", "M1")
ctx:SetImage("attack", "rbxassetid://7333318354");
ctx:GetButton("attack").Position = UDim2.new(0.5, 0, 0.4, 0);
ctx:GetButton("attack").Size = UDim2.new(0, 95, 0, 95);

It works fine, but the following bindings won't trigger at all. The function does not even get called. I also binded the function to KeyCodes, but I'll only post one example here.

ctx:BindAction("primary", handleInput, true, Enum.UserInputType.MouseButton2);
ctx:SetTitle("primary", "M2")
ctx:SetImage("primary", "rbxassetid://7333318354");
ctx:GetButton("primary").Position = UDim2.new(0.25, 0, 0.1, 0);

Any idea as to why this is happening?

1 comment

0

GetButton() yields infinitely. This is a studio bug which have not been fixed. I highly recommend for you to make your own GUI, as CAS isn't to be trusted.