Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a character fly?

I saw the same question in the Roblox Developer Forum but the helper doesn't explain how to make a character fly with FilteringEnabled and I don't know if it works with the now obligatory PGS physics solver. I used to use the Golden Fleece script to make a character fly but in my tests, the Golden Fleece script breaks with the PGS solver enabled, making your character heavy as a rock and it doesn't work with FilteringEnabled.

Summing up, how do I make a character fly with FilteringEnabled and PGS solver?

4 comments

0

disable hat collision and use body thurst thingies to boost yourself in the air

1

Use body movers.

0

XD body movers XD no such thing

0

workspace.Gravity = 0

2 answers

✓ Accepted answer

I took this script i found eventualy when i wanted a fly script too, too make sure nobody thinks im copying, ill say he let me use it and this person's YouTube Account Name is 'RyukoPlays' and thats all i know.

script (huge)

local Player = script.Parent.Parent
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://02882200867"
local PlayAnim = Humanoid:LoadAnimation(Anim)
local Anim2 = Instance.new("Animation")
Anim2.AnimationId = "rbxassetid://02882221865"
local PlayAnim2 = Humanoid:LoadAnimation(Anim2)
local HumaoidRP = Character:WaitForChild("HumanoidRootPart")
local UIS = game:GetService("UserInputService")
local Mouse = Player:GetMouse()


local TapTime = .25
local Tapped = false
local Toggle = false

UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.Space then
		if not Tapped then
			Tapped = true
			wait(TapTime)
			Tapped = false
		else
			if Toggle == false then
				local Jump = Instance.new("BodyVelocity",HumaoidRP)
				Jump.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
				Jump.Velocity = Vector3.new(0,50,0)
				game.Debris:AddItem(Jump,.5)
				wait(.5)
				HumaoidRP.Anchored = true
				PlayAnim2:Play()
				Toggle = true
			elseif Toggle == true then
				Toggle = false
				PlayAnim2:Stop()
				HumaoidRP.Anchored = false
				local Children = HumaoidRP:GetChildren()
				for i, child in pairs(Children) do
					if child:IsA("BodyVelocity") then
						child:Destroy()
					end
				end
			end
		end
	end
end)
UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.W then
		if Toggle == false then return end
		PlayAnim:Play()
		HumaoidRP.Anchored = false
		if HumaoidRP:FindFirstChildOfClass("BodyVelocity") then
			HumaoidRP:FindFirstChildOfClass("BodyVelocity"):Destroy()
		end
		local Forward = Instance.new("BodyVelocity",HumaoidRP)
		Forward.Name = "ForwardMovement"
		Forward.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
		local Gyro = Instance.new("BodyGyro",HumaoidRP)
		Gyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
		Gyro.D = 100
		Gyro.P = 10000
		while Toggle == true do
			Forward.Velocity = Mouse.Hit.lookVector*150
			Gyro.CFrame = Mouse.Hit
			wait()
		end
	end
end)
UIS.InputEnded:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.W then
		if Toggle == false then return end
		if HumaoidRP:FindFirstChild("ForwardMovement") then
			HumaoidRP.ForwardMovement:Destroy()
			HumaoidRP.Anchored = true
			PlayAnim:Stop()
			if HumaoidRP:FindFirstChildOfClass("BodyGyro") then
				HumaoidRP:FindFirstChildOfClass("BodyGyro"):Destroy()
			end
		end
	end
end)
UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.S then
		if Toggle == false then return end
		HumaoidRP.Anchored = false
		if HumaoidRP:FindFirstChildOfClass("BodyVelocity") then
			HumaoidRP:FindFirstChildOfClass("BodyVelocity"):Destroy()
		end
		local Back = Instance.new("BodyVelocity",HumaoidRP)
		Back.Name = "BackMovement"
		Back.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
		local Gyro = Instance.new("BodyGyro",HumaoidRP)
		Gyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
		Gyro.D = 100
		Gyro.P = 10000
		while Toggle == true do
			Back.Velocity = Mouse.Hit.lookVector*-100
			Gyro.CFrame = Mouse.Hit
			wait()
		end
	end
end)
UIS.InputEnded:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.S then
		if Toggle == false then return end
		if HumaoidRP:FindFirstChild("BackMovement") then
			HumaoidRP.BackMovement:Destroy()
			HumaoidRP.Anchored = true
			if HumaoidRP:FindFirstChildOfClass("BodyGyro") then
				HumaoidRP:FindFirstChildOfClass("BodyGyro"):Destroy()
			end
		end
	end
end)

put this in a local script inside StarterPack Folder. Change the Animations as well, i made my own, just replace them or use them, i really dont care, ill allow it. This is the best fly script i got.

local uis = game:GetService("UserInputService")

local rs = game:GetService("RunService")

  

local myPlayer = game.Players.LocalPlayer

local myChar = myPlayer.Character or myPlayer.CharacterAdded:Wait()

local myHRP = myChar:WaitForChild("HumanoidRootPart")

local camera = game.Workspace.CurrentCamera

  

local flying = false

local speed = 0.5

  

  

local bp = Instance.new("BodyPosition", myHRP)

bp.MaxForce = Vector3.new()

bp.D = 10

bp.P = 10000

  

local bg = Instance.new("BodyGyro", myHRP)

bg.MaxTorque = Vector3.new()

bg.D = 10

  

function fly()

flying = true

bp.MaxForce = Vector3.new(400000,400000,400000)

bg.MaxTorque = Vector3.new(400000,400000,400000)

while flying do

rs.RenderStepped:wait()

bp.Position = myHRP.Position +((myHRP.Position - camera.CFrame.p).unit * speed)

bg.CFrame = CFrame.new(camera.CFrame.p, myHRP.Position)

end

end

  

function endFlying()

bp.MaxForce = Vector3.new()

bg.MaxTorque = Vector3.new()

flying = false

end

  

uis.InputBegan:connect(function(input)

if input.KeyCode == Enum.KeyCode.Space then

if not flying then

fly()

else

endFlying()

end

end

end)

This script should make you fly forward when you hit space. Feel free to mess around with it.

This discussion is preserved as it was. New answers, comments, and votes are closed.