I made a jet pack which works to fly when I hold down E, but for some reason when I hold down E it works to fly up but I can't move around using the WASD or Arrow keys? It works to move around when I'm in the air only if I'm not holding down E.
local UIS = game:GetService("UserInputService")
local HoldingE = false
local YVelocity = 0
UIS.InputBegan:Connect(function(inputObject)
if(inputObject.KeyCode == Enum.KeyCode.E)then
HoldingE = true
while HoldingE do
YVelocity = YVelocity + 10
script.Parent.JetPack.Handle.BodyVelocity.MaxForce = Vector3.new(4000, 4000, 4000)
script.Parent.JetPack.Handle.BodyVelocity.Velocity = Vector3.new(0, YVelocity, 0)
wait(0.1)
end
end
end)
UIS.InputEnded:Connect(function(inputObject)
if(inputObject.KeyCode == Enum.KeyCode.E)then
HoldingE = false
YVelocity = 0
script.Parent.JetPack.Handle.BodyVelocity.MaxForce = Vector3.new(0, 0, 0)
end
end)
I've tried removing this part of the script:
YVelocity = YVelocity + 10
script.Parent.JetPack.Handle.BodyVelocity.MaxForce = Vector3.new(4000, 4000, 4000)
script.Parent.JetPack.Handle.BodyVelocity.Velocity = Vector3.new(0, YVelocity, 0)
wait(0.1)
end
And when I removed that part I was able to move using the WASD and Arrow keys, so I would assume that the problem is something to do with the body velocity? (I'm New With Body Velocity)

2 comments
Thank You :)
np!