How To Make A Character Fly

Try to Script it yourself because @EgoMoose would likely be busy.
When I will be on my PC, I will also try to fix the Animation Overlap.

Ok. I think i need to change the last part if not then re-script the whole thing.

Thanks, the file:

is now updated.

3 Likes

This is not working for me? characters

Yeah, it was my fault, my F key didnā€™t work! Good job!

Thanks, it was mainly made by @EgoMoose so credits to him!

This Topic is most likely dead, buttttt @EgoMoose , is there a way to make a fly gui?

1 Like

Yes there is. When connecting to a function that indicates fly and unfly you should do something with the gui that can be called by game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("GUIName").

Instead of using userinputservice, you use mousebutton1click

I was just going through your flying placefile, and Iā€™m trying to understand why the dot product is used here. Would you mind explaining how this works?

local function onUpdate(dt)
	if (isFlying) then
		local cf = camera.CFrame;
		local direction = cf.rightVector*(movement.right - movement.left) + cf.lookVector*(movement.forward - movement.backward);
		if (direction:Dot(direction) > 0) then
			direction = direction.unit;
		end
		bodyGyro.CFrame = cf;
		bodyVel.Velocity = direction * humanoid.WalkSpeed * 3;
	end
end
1 Like

when would this activate? as i throught it would activate on space

1 Like

hello Iā€™m a bit late to this, but would anyone know how to make this mobile supported. Iā€™ve been trying for several days to make this mobile supported but with no luck. any help would be greatly appreciated.

@EgoMoose I am trying to get the Flight controls to work on mobile Dynamic Thumbstick input.

When the character walks around on the ground, the thumbstick works perfectly.

As soon as the character takes flight, the thumbstick stops working. Setting a breakpoint in the handler for ContextActionService:BindAction() I see that the callback is never called while the character is flying.

Do you know how to get the ContextActionService bound actions to fire on mobile input, even when the character is not touching the ground?

Actually I went ahead and solved for the mobile controls!

I posted my remix here
https://www.roblox.com/games/7362782534
This is uncopylocked so please feel free to use this.

Full mobile support! Both classic and dynamic thumbstick!

I noticed the ContextActionService is not firing Enum.PlayerAction reliably on mobile while the character is in flight.

So I added hooks into UserInputService and determine if the player is swiping in the thumbstick area, and then adapt that into the existing movement structure that was in the Fly code already.

Please review it for completeness and accuracy and do let me know if thereā€™s anything I missed!

9 Likes

This is really nice! I appreciate this.

1 Like

@HCTGT_RBLX I have today published an update to my Mobile Flight Example that makes the motion smooth instead of on/off binary. Itā€™s a lot easier to use on my handset. Please give it a try.

1 Like

You bet I will. Iā€™m always open to new things.

Awesome script, very clever and well commented! Thank you for sharing :slight_smile:

1 Like

Looks pretty awesome. Thanks for sharing. Would it be relatively straightforward to add a ā€œMIN-HEIGHTā€ constant so it could be used for spectating a game in progress without the flying player being able to get down to ground level?

Mouse is deprecated and shouldnā€™t be used. UserInputService has Enums for mouse presses.