Quenty
(Quenty)
January 8, 2019, 9:31pm
#1
Binding KeyCode.ButtonR2 or KeyCode.ButtonL2 while player is in vehicle seat causes acceleration or deceleration permanently.
This causes vehicles to accelerate permanently even after leaving and re-entering the seat.
Steps to reproduce
Have player sit in vehicle seat
Hold down W to get Throttle stuck forwards
Bind ButtonR2 at Enum.ContextActionPriority.High.Value
Check Throttle, it’ll be stuck at 1
Expected behavior: Any acceleration from ButtonR2 is removed
Why I think this happens
See this code, where we blindly bind OnThrottleAccel().
note: Although on closer inspection, I’m not sure this is the code handling vehicle seats, since this appears to not be valid code.
function VehicleController:Enable(enable, vehicleSeat)
if enable == self.enabled and vehicleSeat == self.vehicleSeat then
return
end
if enable then
if vehicleSeat then
self.vehicleSeat = vehicleSeat
if useTriggersForThrottle then
ContextActionService:BindAction("throttleAccel", (function() self:OnThrottleAccel() end), false, Enum.KeyCode.ButtonR2)
ContextActionService:BindAction("throttleDeccel", (function() self:OnThrottleDeccel() end), false, Enum.KeyCode.ButtonL2)
end
ContextActionService:BindAction("arrowSteerRight", (function() self:OnSteerRight() end), false, Enum.KeyCode.Right)
ContextActionService:BindAction("arrowSteerLeft", (function() self:OnSteerLeft() end), false, Enum.KeyCode.Left)
end
else
if useTriggersForThrottle then
ContextActionService:UnbindAction("throttleAccel")
ContextActionService:UnbindAction("throttleDeccel")
end
However, OnThrottleAccel does not handle the case where UserInputState.Cancel
occurs, which is what happens here.
ContextActionService:UnbindAction("throttleAccel")
ContextActionService:UnbindAction("throttleDeccel")
end
ContextActionService:UnbindAction("arrowSteerRight")
ContextActionService:UnbindAction("arrowSteerLeft")
self.vehicleSeat = nil
end
end
function VehicleController:OnThrottleAccel(actionName, inputState, inputObject)
self.acceleration = (inputState ~= Enum.UserInputState.End) and -1 or 0
self.throttle = self.acceleration + self.decceleration
end
function VehicleController:OnThrottleDeccel(actionName, inputState, inputObject)
self.decceleration = (inputState ~= Enum.UserInputState.End) and 1 or 0
self.throttle = self.acceleration + self.decceleration
end
function VehicleController:OnSteerRight(actionName, inputState, inputObject)
self.turningRight = (inputState ~= Enum.UserInputState.End) and 1 or 0
This occurs on the current version of Roblox.
5 Likes
Can confirm, this bug is still live. I’ve been trying to figure the reason for this behavior in my game for the past three months, I eventually narrowed it down to binding ButtonL2.
This is incredibly annoying, not intuitive in the slightest, and should be addressed ASAP.
Sorry for the delay.
I was able to figure it out while trying to create a repro. It was due to using ContextActionService to bind a crouch animation to the gun. Not entirely sure why yet.
EDIT: Apparently binding ButtonL2 causes it.
[image]
Not sure if bug or I’m doing it improperly.
3 Likes
Airennor
(Airennor)
February 21, 2019, 6:25am
#3
A similar bug is while you’re accelerating, pull out a tool for this same exact permanent cycle. I will get out to stop then get back in without pressing the “W” key and it will automatically go back to the previous acceleration point. I’m unsure if there is a way around this one.
1 Like
Any word on solving this bug?
It is still active nearly half a year later with no input from staff. It makes designing cars very difficult.