Hello. As the title says, when the player holds backspace button in chat on mobile, a computer cursor appears on the chat bar and then 3 of my context action service buttons stop working as intended. They still work, but I suddenly become unable to hold them.
local function leftClick(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
MouseLeftClick.Value = true
print("leftTrue")
elseif inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel or inputState == Enum.UserInputState.None then
MouseLeftClick.Value = false
print("leftFalse")
end
end
local function rightClick(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
MouseRightClick.Value = true
print("rightTrue")
elseif inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel or inputState == Enum.UserInputState.None then
MouseRightClick.Value = false
print("rightFalse")
end
end
local function SS(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
MouseRightClick.Value = true
MouseLeftClick.Value = true
elseif inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel or inputState == Enum.UserInputState.None then
MouseRightClick.Value = false
MouseLeftClick.Value = false
end
end
CAS:BindAction("L", leftClick, true)
CAS:BindAction("R", rightClick, true)
CAS:BindAction("SS", SS, true)
local startDB = false
UIS.InputBegan:Connect(function(input, gpe)
if gpe then return end
if startDB then return end
local lastInput = UIS:GetLastInputType()
if lastInput == Enum.UserInputType.Touch then
startDB = true
task.delay(2, function()
CAS:SetPosition("L", UDim2.new(0.372, 0,0.627, 0))
CAS:SetImage("L", "rbxassetid://18492614584")
local L = CAS:GetButton("L")
L.ImageColor3 = Color3.new(0.384314, 0.384314, 0.384314)
L.Size = UDim2.new(0.143, 0,0.29, 0)
local LImage = L:WaitForChild("ActionIcon")
LImage.Position = UDim2.new(0,0,0,0)
LImage.Size = UDim2.new(1,0,1,0)
CAS:SetPosition("R", UDim2.new(0.62, 0,0.143, 0))
CAS:SetImage("R", "rbxassetid://18492819425")
local R = CAS:GetButton("R")
R.ImageColor3 = Color3.new(0.384314, 0.384314, 0.384314)
R.Size = UDim2.new(0.143, 0,0.29, 0)
local RImage = R:WaitForChild("ActionIcon")
RImage.Position = UDim2.new(0,0,0,0)
RImage.Size = UDim2.new(1,0,1,0)
CAS:SetPosition("SS", UDim2.new(0.446, 0,0.264, 0))
CAS:SetImage("SS", "rbxassetid://18492787606")
local SS = CAS:GetButton("SS")
SS.ImageColor3 = Color3.new(0.384314, 0.384314, 0.384314)
SS.Size = UDim2.new(0.143, 0,0.29, 0)
local SSImage = SS:WaitForChild("ActionIcon")
SSImage.Position = UDim2.new(0,0,0,0)
SSImage.Size = UDim2.new(1,0,1,0)
end)
end
end)
Normally it prints “rightTrue” when I first press and then prints “rightFalse” when I release, but once they get broken both gets printed at the same time. Any ideas about how can I fix this?
Here is the link of the game if you want to see it for yourself. Open the chat, hold down backspace and the buttons should stop working properly.