Hello,
I am working on a script that makes you fly when you double press jump. When a player on the computer double jumps, it works perfectly. However, when a mobile player double jumps with their special jump button, they only need to jump once to start flying (but twice to stop flying??). I think the reason this does not work is because JumpRequest gets triggered multiple times during a jump but I am not sure how to fix this.
Here is the part for mobile players that I am struggling with:
function JumpRequest()
if uis.TouchEnabled and not uis.KeyboardEnabled and not uis.MouseEnabled then
if not Tapped then
Tapped = true
wait(TapTime)
Tapped = false
else
if not flying then
fly()
else
endFlying()
end
end
end
end
uis.JumpRequest:Connect(JumpRequest)
And this is how I do it for computer players:
uis.InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.Space then
if not Tapped then
Tapped = true
wait(TapTime)
Tapped = false
else
if not flying then
fly()
else
endFlying()
end
end
end
end)
By the way, if there is a way to merge both of these together, I am open to suggestions!
Thanks for your help and time!
