-
I want them to fly up and down at the same speed
-
I click e and i go up the right way and speed, but when i stop and click e again or click q to go down i slow down significantly, and as i switch back from q and e to go up and down it gets slower and slower until it stops completely
edown = false
qdown = false
uis.InputBegan:connect(function(key,process)
if not process and key.KeyCode == Enum.KeyCode.E and flying == true and edown == false then
edown = true
coroutine.resume(coroutine.create(function()
while wait() do
if char:WaitForChild("HumanoidRootPart"):FindFirstChild("BodyPosition") then
if edown == true then
bp.Position = bp.Position * char:WaitForChild("HumanoidRootPart").CFrame.UpVector * 10
elseif edown == false then
bp.Position = char:WaitForChild("HumanoidRootPart").Position
end
end
end
end))
end
if not process and key.KeyCode == Enum.KeyCode.Q and flying == true and qdown == false then
qdown = true
coroutine.resume(coroutine.create(function()
while wait() do
if char:WaitForChild("HumanoidRootPart"):FindFirstChild("BodyPosition") then
if qdown == true then
bp.Position = bp.Position * -char:WaitForChild("HumanoidRootPart").CFrame.UpVector *10
elseif qdown == false then
bp.Position = char:WaitForChild("HumanoidRootPart").Position
end
end
end
end))
end
end)
uis.InputEnded:connect(function(key,process)
if key.KeyCode == Enum.KeyCode.E and edown == true then
edown = false
end
if key.KeyCode == Enum.KeyCode.Q and qdown == true then
qdown = false
end
end)
This is the chunk of my code were all the flying is taken care of.