Hey,
I have an Airstairs vehicle which can raise and fall to adjust to the height of the aircraft.
I’m trying to put key binds onto it to make the users have easier control over it, it works as intended for the most part, however I’m trying to eradicate an issue where if you press both the raise and fall keybind (in my case ‘q’ & ‘e’) at the same time, or between KeyUp It will run them at the same time which messes up the animation.
Keybind Script (LocalScript)
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == 'q' and key ~= 'e' then
DOWN:FireServer()
end
end)
mouse.KeyUp:connect(function(key)
key = key:lower()
if key == 'q' and key ~= 'e' then
STOP:FireServer()
end
end)
Function Script (ServerScript)
function setRampRaiseT()
Hold = true
while Hold do
StepMotor.DesiredAngle += TurnRateA * RS.Heartbeat:Wait()
BasketMotor.DesiredAngle -= TurnRateA * RS.heartbeat:Wait()
end
end
function setRampLowerT()
Hold = true
while Hold do
StepMotor.DesiredAngle += TurnRateB * RS.Heartbeat:Wait()
BasketMotor.DesiredAngle -= TurnRateB * RS.heartbeat:Wait()
end
end
Events.UP.OnServerEvent:Connect(setRampRaiseT) -- MOVE
Events.STOP.OnServerEvent:Connect(function() Hold = false end) -- STOP
I tried to use the ‘~=’ operator to see if that would fix it, but unfortunately I have not been blessed with that simple fix.
Any help would be appreciated