Hello, today I have come to ask for help on an issue that has been plaguing my game almost since its creation.
My team has had to create mobile controls so that mobile users can race in our game and still be able to compete. However, there is one problem that has driven many mobile players from our game. When ever people play on mobile, from time to time they will continuously keep turning in the same direction even after they have let go, and this video is evidence for that:
If I need to provide code for our controls I will be happy to, but for now, take a look at this video:
Notice when I tap the button, hold the button, or anything like that it works fine. But when I start pressing inside the button and then come off of it,
This won’t fire:
left.InputChanged:Connect(function(input)
if input.UserInputState == Enum.UserInputState.Cancel then
leftMouse = false
game.ReplicatedStorage.CarThrottle:FireServer(direction, leftMouse)
end
end)
All three ways we have tried to capture the player’s finger leaving the mobile conrtrols, and for some reason, all have failed, why is this? Our code? A roblox bug? I would very much like to know.
function leftOn()
local direction = "Left"
left.MouseButton1Down:Connect(function()
leftMouse = true
while leftMouse == true do
game.ReplicatedStorage.CarThrottle:FireServer(direction, leftMouse)
task.wait()
end
end)
end
The function leftOn is fired every time a new a player resets so it can lock on to the new UI. If I put the loop outside then it would start immediately.
function leftOn()
local direction = "Left"
left.MouseButton1Down:Connect(function()
leftMouse = true
while leftMouse == true do
game.ReplicatedStorage.CarThrottle:FireServer(direction, leftMouse)
task.wait()
end
end)
end
function leftOn()
local direction = "Left"
left.MouseButton1Down:Connect(function()
leftMouse = true
end)
while leftMouse == true do
game.ReplicatedStorage.CarThrottle:FireServer(direction, leftMouse)
task.wait()
end
end
function leftOn()
local direction = "Left"
local leftMouse = nil
left.MouseButton1Down:Connect(function()
leftMouse = true
end)
left.MouseButton1Up:Connect(function()
leftMouse = false
end)
while leftMouse == true do
game.ReplicatedStorage.CarThrottle:FireServer(direction, leftMouse)
task.wait()
end