sp=script.Parent speed=2 topspeed=50 function waitfor(w,I)while w:FindFirstChild(I)==nil do wait()end return w:FindFirstChild(I)end local w=waitfor(sp,"\099\111\097\115\116\105\110\103\112\111\115\101")local I=waitfor(sp,"\108\101\102\116\116\117\114\110")local y=waitfor(sp,"\114\105\103\104\116\116\117\114\110")local p=waitfor(sp,"\072\097\110\100\108\101")local x=waitfor(p,"\087\105\110\100")local X=waitfor(p,"\077\101\115\104")inertia=1-speed/topspeed debris=game:GetService("\068\101\098\114\105\115")equipped=false flying=false controls={forward=0;backward=0;left=0,right=0}momentum=Vector3.new(0,0,0)lastmomentum=Vector3.new(0,0,0)totalmomentum=0 tilt=0 lasttilt=0 currentanim="\099\111\097\115\116"lastanim=x X.Scale=Vector3.new(3,3,3)p.Size=Vector3.new(2,1.5,3)sp.Grip=CFrame.new(0,0,0)function RemoveFlyStuff()x:Stop()local w=game.Players.LocalPlayer if w then local I=w.Character if I then for w,I in ipairs(I:getChildren())do if I.Name=="\072\117\109\097\110\111\105\100"then I.PlatformStand=false end if I and I.Name=="\069\102\102\101\099\116\067\108\111\117\100"then I:remove()end end local w=I:FindFirstChild("\084\111\114\115\111")if w~=nil then for w,I in ipairs(w:GetChildren())do if I and(I.Name=="\070\108\105\103\104\116\071\121\114\111"or I.Name=="\070\108\105\103\104\116\086\101\108\111\099\105\116\121")then I:remove()end end end end end p.Transparency=0 p.Smoke.Enabled=true if lastanim~=nil then lastanim:Stop()end end function fly()if not equipped then flying=false else flying=not flying end RemoveFlyStuff()if flying then local X=sp.Parent:FindFirstChild("\084\111\114\115\111")local B=sp.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")if X and(B and B.Health>0)then p.Transparency=1 p.Smoke.Enabled=false B.PlatformStand=true momentum=(X.Velocity+X.CFrame.lookVector*10)+Vector3.new(0,3,0)local m=Instance.new("\066\111\100\121\071\121\114\111")m.Name="\070\108\105\103\104\116\071\121\114\111"m.P=1000000.0 m.maxTorque=Vector3.new(m.P,m.P,m.P)m.cframe=X.CFrame m.Parent=X velocity=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")velocity.Name="\070\108\105\103\104\116\086\101\108\111\099\105\116\121"velocity.velocity=Vector3.new(0,0,0)velocity.P=10000.0 velocity.maxForce=Vector3.new(1,1,1)*1000000.0 velocity.Parent=X local l=p:clone()l.Transparency=0 l.CanCollide=false;(waitfor(l,"\083\109\111\107\101")).Enabled=true l.Name="\069\102\102\101\099\116\067\108\111\117\100"local K=Instance.new("\087\101\108\100")K.Part0=X K.Part1=l K.C0=CFrame.new(1,-4,0)*CFrame.Angles(0,math.pi/2,0)K.Parent=l l.Parent=sp.Parent if lastanim~=nil then lastanim:Stop()end lastanim=B:LoadAnimation(w)lastanimused=0 if lastanim then lastanim:Play(.5)end x:Play()while flying and(X and(B and(B.Health>0 and equipped)))do local p=game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(Vector3.new(controls.left+controls.right,math.abs(controls.forward)*.2,controls.forward+controls.backward))*speed momentum=momentum*inertia+p totalmomentum=math.min(momentum.magnitude,topspeed)local X=totalmomentum/topspeed if l~=nil then local w=l:FindFirstChild("\077\101\115\104")w.Scale=Vector3.new(4,4,4+X*4)end x.Pitch=X*2+1 x.Volume=X+.1 local K=((momentum*Vector3.new(1,0,1)).unit:Cross((lastmomentum*Vector3.new(1,0,1)).unit)).y if tostring(K)=="-\049\046\035\073\078\068"or tostring(K)=="\049\046\035\073\078\068"or K==math.huge or K==-math.huge or tostring(0/0)==tostring(K)then K=0 end local V=math.abs(K)if V>.06 or V<.0001 then if math.abs(lasttilt)>.0001 then K=lasttilt*.96 else K=0 end else K=lasttilt*.9+K*.1 end lasttilt=K if K>.01 then if lastanimused~=1 then lastanim:Stop(.5)lastanim=B:LoadAnimation(y)lastanim:Play(.5)lastanimused=1 end elseif K<-0.01 then if lastanimused~=-1 then lastanim:Stop(.5)lastanim=B:LoadAnimation(I)lastanim:Play(.5)lastanimused=-1 end elseif lastanimused~=0 then lastanim:Stop(.5)lastanim=B:LoadAnimation(w)lastanim:Play(.5)lastanimused=0 end if totalmomentum<.5 then momentum=Vector3.new(0,0,0)totalmomentum=0 m.cframe=CFrame.new(Vector3.new(0,0,0),game.Workspace.CurrentCamera.CoordinateFrame.lookVector*Vector3.new(1,0,1))*CFrame.Angles(0,-math.pi/2,0)else m.cframe=(CFrame.new(Vector3.new(0,0,0),momentum)*CFrame.Angles(0,-math.pi/2,0))*CFrame.Angles(K*-20,0,0)end velocity.velocity=momentum lastmomentum=momentum wait(rate)end end RemoveFlyStuff()flying=false end end function onEquipped(w)equipped=true if w~=nil then w.Icon="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\092\071\117\110\067\117\114\115\111\114\046\112\110\103"w.Button1Down:connect(function()fly()local w=sp.Parent:FindFirstChild("\084\111\114\115\111")if w~=nil then w.Velocity=momentum end end)w.KeyDown:connect(function(w)local I=string.byte(w)if I==32 then elseif I==string.byte("\119")or I==17 then controls.forward=-1 elseif I==string.byte("\097")or I==20 then controls.left=-1 elseif I==string.byte("\115")or I==18 then controls.backward=1 elseif I==string.byte("\100")or I==19 then controls.right=1 end end)w.KeyUp:connect(function(w)local I=string.byte(w)if I==string.byte("\119")or I==17 then controls.forward=0 elseif I==string.byte("\097")or I==20 then controls.left=0 elseif I==string.byte("\115")or I==18 then controls.backward=0 elseif I==string.byte("\100")or I==19 then controls.right=0 end end)end end function onUnequipped()equipped=false end sp.Equipped:connect(onEquipped)sp.Unequipped:connect(onUnequipped)
--Made by Stickmasterluke

sp = script.Parent

speed = 2
topspeed = 50

function waitfor(parent, name)
	while parent:FindFirstChild(name) == nil do
		wait()
	end
	return parent:FindFirstChild(name)
end

local canim = waitfor(sp, "coastingpose")
local lanim = waitfor(sp, "leftturn")
local ranim = waitfor(sp, "rightturn")
local handle = waitfor(sp, "Handle")
local wind = waitfor(handle, "Wind")
local mesh = waitfor(handle, "Mesh")

inertia = 1 - (speed / topspeed)
debris = game:GetService("Debris")
equipped = false
flying = false
controls = { forward = 0, backward = 0, left = 0, right = 0 }
momentum = Vector3.new(0, 0, 0)
lastmomentum = Vector3.new(0, 0, 0)
totalmomentum = 0
tilt = 0
lasttilt = 0
currentanim = "coast"
lastanim = wind
mesh.Scale = Vector3.new(3, 3, 3)
handle.Size = Vector3.new(2, 1.5, 3)
sp.Grip = CFrame.new(0, 0, 0)

function RemoveFlyStuff()
	wind:Stop()
	local plr = game.Players.LocalPlayer
	if plr then
		local chr = plr.Character
		if chr then
			for i, v in ipairs(chr:getChildren()) do
				if v.Name == "Humanoid" then
					v.PlatformStand = false
				end
				if v and v.Name == "EffectCloud" then
					v:remove()
				end
			end
			local torso = chr:FindFirstChild("Torso")
			if torso ~= nil then
				for i, v in ipairs(torso:GetChildren()) do
					if v and (v.Name == "FlightGyro" or v.Name == "FlightVelocity") then
						v:remove()
					end
				end
			end
		end
	end
	handle.Transparency = 0
	handle.Smoke.Enabled = true
	if lastanim ~= nil then
		lastanim:Stop()
	end
end

function fly() --(de)activate fly mode
	if not equipped then
		flying = false
	else
		flying = not flying
	end
	RemoveFlyStuff()
	if flying then
		local torso = sp.Parent:FindFirstChild("Torso")
		local humanoid = sp.Parent:FindFirstChild("Humanoid")
		if torso and humanoid and humanoid.Health > 0 then
			handle.Transparency = 1
			handle.Smoke.Enabled = false
			humanoid.PlatformStand = true
			momentum = torso.Velocity + (torso.CFrame.lookVector * 10) + Vector3.new(0, 3, 0)

			local gyro = Instance.new("BodyGyro")
			gyro.Name = "FlightGyro"
			gyro.P = 10 ^ 6
			gyro.maxTorque = Vector3.new(gyro.P, gyro.P, gyro.P)
			gyro.cframe = torso.CFrame
			gyro.Parent = torso

			velocity = Instance.new("BodyVelocity")
			velocity.Name = "FlightVelocity"
			velocity.velocity = Vector3.new(0, 0, 0)
			velocity.P = 10 ^ 4
			velocity.maxForce = Vector3.new(1, 1, 1) * (10 ^ 6)
			velocity.Parent = torso

			local cloud = handle:clone()
			cloud.Transparency = 0
			cloud.CanCollide = false
			waitfor(cloud, "Smoke").Enabled = true
			cloud.Name = "EffectCloud"
			local w = Instance.new("Weld")
			w.Part0 = torso
			w.Part1 = cloud
			w.C0 = CFrame.new(1, -4, 0) * CFrame.Angles(0, math.pi / 2, 0)
			w.Parent = cloud
			cloud.Parent = sp.Parent

			if lastanim ~= nil then
				lastanim:Stop()
			end
			lastanim = humanoid:LoadAnimation(canim)
			lastanimused = 0
			if lastanim then
				lastanim:Play(0.5)
			end
			wind:Play()
			while flying and torso and humanoid and humanoid.Health > 0 and equipped do
				local movement = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(
					Vector3.new(
						controls.left + controls.right,
						math.abs(controls.forward) * 0.2,
						controls.forward + controls.backward
					)
				) * speed

				momentum = (momentum * inertia) + movement
				totalmomentum = math.min(momentum.magnitude, topspeed)
				local momentumpercent = (totalmomentum / topspeed)
				if cloud ~= nil then
					local m = cloud:FindFirstChild("Mesh")
					m.Scale = Vector3.new(4, 4, 4 + (momentumpercent * 4))
				end
				wind.Pitch = (momentumpercent * 2) + 1
				wind.Volume = momentumpercent + 0.1

				local tilt = ((momentum * Vector3.new(1, 0, 1)).unit:Cross((lastmomentum * Vector3.new(1, 0, 1)).unit)).y
				if
					tostring(tilt) == "-1.#IND"
					or tostring(tilt) == "1.#IND"
					or tilt == math.huge
					or tilt == -math.huge
					or tostring(0 / 0) == tostring(tilt)
				then
					tilt = 0
				end
				local abstilt = math.abs(tilt)
				if abstilt > 0.06 or abstilt < 0.0001 then
					if math.abs(lasttilt) > 0.0001 then
						tilt = lasttilt * 0.96
					else
						tilt = 0
					end
				else
					tilt = (lasttilt * 0.9) + (tilt * 0.1) --weighted average
				end
				lasttilt = tilt
				if tilt > 0.01 then
					if lastanimused ~= 1 then
						lastanim:Stop(0.5)
						lastanim = humanoid:LoadAnimation(ranim)
						lastanim:Play(0.5)
						lastanimused = 1
					end
				elseif tilt < -0.01 then
					if lastanimused ~= -1 then
						lastanim:Stop(0.5)
						lastanim = humanoid:LoadAnimation(lanim)
						lastanim:Play(0.5)
						lastanimused = -1
					end
				elseif lastanimused ~= 0 then
					lastanim:Stop(0.5)
					lastanim = humanoid:LoadAnimation(canim)
					lastanim:Play(0.5)
					lastanimused = 0
				end
				if totalmomentum < 0.5 then
					momentum = Vector3.new(0, 0, 0)
					totalmomentum = 0
					gyro.cframe = CFrame.new(
						Vector3.new(0, 0, 0),
						game.Workspace.CurrentCamera.CoordinateFrame.lookVector * Vector3.new(1, 0, 1)
					) * CFrame.Angles(0, -math.pi / 2, 0)
				else
					gyro.cframe = CFrame.new(Vector3.new(0, 0, 0), momentum)
						* CFrame.Angles(0, -math.pi / 2, 0)
						* CFrame.Angles(tilt * -20, 0, 0)
				end
				velocity.velocity = momentum
				lastmomentum = momentum
				wait(rate)
			end
		end
		RemoveFlyStuff()
		flying = false
	end
end

function onEquipped(mouse)
	equipped = true
	if mouse ~= nil then
		mouse.Icon = "rbxasset://textures\\GunCursor.png"
		mouse.Button1Down:connect(function()
			fly()
			local torso = sp.Parent:FindFirstChild("Torso")
			if torso ~= nil then
				torso.Velocity = momentum
			end
		end)
		mouse.KeyDown:connect(function(key2)
			local key = string.byte(key2)
			if key == 32 then --Space bar
				--[[fly()
				local torso=sp.Parent:FindFirstChild("Torso")
				if torso~=nil then
					torso.Velocity=momentum
				end]]
			elseif key == string.byte("w") or key == 17 then
				controls.forward = -1
			elseif key == string.byte("a") or key == 20 then
				controls.left = -1
			elseif key == string.byte("s") or key == 18 then
				controls.backward = 1
			elseif key == string.byte("d") or key == 19 then
				controls.right = 1
			end
		end)
		mouse.KeyUp:connect(function(key2)
			local key = string.byte(key2)
			if key == string.byte("w") or key == 17 then
				controls.forward = 0
			elseif key == string.byte("a") or key == 20 then
				controls.left = 0
			elseif key == string.byte("s") or key == 18 then
				controls.backward = 0
			elseif key == string.byte("d") or key == 19 then
				controls.right = 0
			end
		end)
	end
end

function onUnequipped()
	equipped = false
end

sp.Equipped:connect(onEquipped)
sp.Unequipped:connect(onUnequipped)
