(Answered) Jet Pack works to fly but can't move on X and Z?
Asked by
6 years ago Edited 6 years ago
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.
01 | local UIS = game:GetService( "UserInputService" ) |
05 | UIS.InputBegan:Connect( function (inputObject) |
06 | if (inputObject.KeyCode = = Enum.KeyCode.E) then |
09 | YVelocity = YVelocity + 10 |
10 | script.Parent.JetPack.Handle.BodyVelocity.MaxForce = Vector 3. new( 4000 , 4000 , 4000 ) |
11 | script.Parent.JetPack.Handle.BodyVelocity.Velocity = Vector 3. new( 0 , YVelocity, 0 ) |
17 | UIS.InputEnded:Connect( function (inputObject) |
18 | if (inputObject.KeyCode = = Enum.KeyCode.E) then |
21 | script.Parent.JetPack.Handle.BodyVelocity.MaxForce = Vector 3. new( 0 , 0 , 0 ) |
I've tried removing this part of the script:
1 | YVelocity = YVelocity + 10 |
2 | script.Parent.JetPack.Handle.BodyVelocity.MaxForce = Vector 3. new( 4000 , 4000 , 4000 ) |
3 | script.Parent.JetPack.Handle.BodyVelocity.Velocity = Vector 3. new( 0 , YVelocity, 0 ) |
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)