So I have a flying script that lets a player fly when they press V. This part of the script below changes the position of the player. When I hold W and press V to start flying, it works. But if I press V to deactivate the flying then press V to activate it again, while still holding W, the player won't move until I remove my finger from the W button and hold it again. Is there any changes I can make to the script below to fix this? I want to be able to keep moving when deactivating and activating flying.
mouse.KeyDown:connect(function(key)
if key:lower() == "w" then
ctrl.f = 1
elseif key:lower() == "s" then
ctrl.b = -1
elseif key:lower() == "a" then
ctrl.l = -1
elseif key:lower() == "d" then
ctrl.r = 1
end
end)
mouse.KeyUp:connect(function(key)
if key:lower() == "w" then
ctrl.f = 0
elseif key:lower() == "s" then
ctrl.b = 0
elseif key:lower() == "a" then
ctrl.l = 0
elseif key:lower() == "d" then
ctrl.r = 0
end
end)
Fly()

2 comments
You could make it so the script checks if any keys are pressed when it activates and deactivates.
What would I use to do that? If you can provide me an example that would be appreciated!