I have created an engine that moves a vehicle in my game. The problem is in the part of turning the vehicle. When I'm pressing the A and I press the D without releasing the A key, the vehicle does not turn in any direction.
UserInputService.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.A and game.Workspace.MotoVoladora.Seat:FindFirstChild("SeatWeld") then
print("Pressing A")
game.Workspace.MotoVoladora.Motor.BodyThrust.Force = Vector3.new(12,0,0)
end
end)
UserInputService.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.D and game.Workspace.MotoVoladora.Seat:FindFirstChild("SeatWeld") then
print("Pressing D")
game.Workspace.MotoVoladora.Motor.BodyThrust.Force = Vector3.new(-12,0,0)
end
end)
UserInputService.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.A or key.KeyCode == Enum.KeyCode.D and game.Workspace.MotoVoladora.Seat:FindFirstChild("SeatWeld") then
print("Not pressing A/D")
game.Workspace.MotoVoladora.Motor.BodyThrust.Force = Vector3.new(0,0,0)
end
end)
From what I've seen in the output, this happens because when I press another key without releasing the first key, the vehicle stops turning after releasing the first key.
Image: https://imgur.com/a/paqRmep
I've been trying for several hours to find a solution without success..

2 comments
https://www.robloxdev.com/api-reference/function/UserInputService/IsKeyDown
Justo acabo de solucionarlo haciendo un montón de condiciones y comprobaciones, que estoy seguro de que no hacia falta hacer tanto, pero ha funcionado. Lo de IsKeyDown ya lo probé en su momento y no logré solucionarlo. Igualmente muchas gracias ^^