Seat=script.Parent Model=Seat.Parent Engine=Model:WaitForChild("\069\110\103\105\110\101")BeamPart=Model:WaitForChild("\066\101\097\109\080\097\114\116")Lights=Model:WaitForChild("\076\105\103\104\116\115")Seats=Model:WaitForChild("\083\101\097\116\115")Sounds={Flying=Engine:WaitForChild("\085\070\079\095\070\108\121\105\110\103"),Beam=Engine:WaitForChild("\085\070\079\095\066\101\097\109"),Idle=Engine:WaitForChild("\085\070\079\095\073\100\108\101"),TakingOff=Engine:WaitForChild("\085\070\079\095\084\097\107\105\110\103\095\079\102\102")}Players=game:GetService("\080\108\097\121\101\114\115")Debris=game:GetService("\068\101\098\114\105\115")BeamSize=50 CurrentBeamSize=0 MaxVelocity=40 MinVelocity=-40 MaxSideVelocity=40 MinSideVelocity=-40 Acceleration=2 Deceleration=2 AutoDeceleration=2 SideAcceleration=2 SideDeceleration=2 AutoSideDeceleration=2 LiftOffSpeed=5 LiftSpeed=10 LowerSpeed=-10 Velocity=Vector3.new(0,0,0)SideVelocity=0 FlipForce=1000000 InUse=false PlayerUsing=nil PlayerControlScript=nil PlayerConnection=nil BeamActive=false TakingOff=false LightsEnabled=false Enabled=false Controls={Forward={Key="\087",Byte=17;Mode=false},Backward={Key="\083",Byte=18;Mode=false};Left={Key="\065";Byte=20,Mode=false};Right={Key="\068";Byte=19;Mode=false},Up={Key="\081";Byte=113;Mode=false},Down={Key="\069",Byte=101;Mode=false}}ControlScript=script:WaitForChild("\067\111\110\116\114\111\108\083\099\114\105\112\116")Beam=Instance.new("\080\097\114\116")Beam.Name="\066\101\097\109"Beam.Transparency=.3 Beam.BrickColor=BrickColor.new("\080\097\115\116\101\108 \066\108\117\101")Beam.Material=Enum.Material.Plastic Beam.Shape=Enum.PartType.Block Beam.TopSurface=Enum.SurfaceType.Smooth Beam.BottomSurface=Enum.SurfaceType.Smooth Beam.FormFactor=Enum.FormFactor.Custom Beam.Size=Vector3.new(BeamPart.Size.X,.2,BeamPart.Size.Z)Beam.Anchored=false Beam.CanCollide=false BeamMesh=Instance.new("\067\121\108\105\110\100\101\114\077\101\115\104")BeamMesh.Parent=Beam script.Parent.Parent.BeamPart.SpotLight.Enabled=true for b,W in pairs(Sounds)do W:Stop()end RemoteConnection=script:FindFirstChild("\082\101\109\111\116\101\067\111\110\110\101\099\116\105\111\110")if not RemoteConnection then RemoteConnection=Instance.new("\082\101\109\111\116\101\070\117\110\099\116\105\111\110")RemoteConnection.Name="\082\101\109\111\116\101\067\111\110\110\101\099\116\105\111\110"RemoteConnection.Parent=script end BodyGyro=Engine:FindFirstChild("\066\111\100\121\071\121\114\111")if not BodyGyro then BodyGyro=Instance.new("\066\111\100\121\071\121\114\111")BodyGyro.Parent=Engine end BodyGyro.maxTorque=Vector3.new(0,0,0)BodyGyro.D=7500 BodyGyro.P=10000 BodyPosition=Engine:FindFirstChild("\066\111\100\121\080\111\115\105\116\105\111\110")if not BodyPosition then BodyPosition=Instance.new("\066\111\100\121\080\111\115\105\116\105\111\110")BodyPosition.Parent=Engine end BodyPosition.maxForce=Vector3.new(0,0,0)BodyPosition.D=10000 BodyPosition.P=50000 BodyVelocity=Engine:FindFirstChild("\066\111\100\121\086\101\108\111\099\105\116\121")if not BodyVelocity then BodyVelocity=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")BodyVelocity.Parent=Engine end BodyVelocity.velocity=Vector3.new(0,0,0)BodyVelocity.maxForce=Vector3.new(0,0,0)BodyVelocity.P=10000 FlipGyro=BeamPart:FindFirstChild("\070\108\105\112\071\121\114\111")if not FlipGyro then FlipGyro=Instance.new("\066\111\100\121\071\121\114\111")FlipGyro.Name="\070\108\105\112\071\121\114\111"FlipGyro.Parent=BeamPart end FlipGyro.maxTorque=Vector3.new(0,0,0)FlipGyro.D=500 FlipGyro.P=3000 RiseVelocity=BeamPart:FindFirstChild("\082\105\115\101\086\101\108\111\099\105\116\121")if not RiseVelocity then RiseVelocity=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")RiseVelocity.Name="\082\105\115\101\086\101\108\111\099\105\116\121"RiseVelocity.Parent=BeamPart end RiseVelocity.velocity=Vector3.new(0,0,0)RiseVelocity.maxForce=Vector3.new(0,0,0)RiseVelocity.P=10000 function RayCast(b,W,X,A)return(game:GetService("\087\111\114\107\115\112\097\099\101")):FindPartOnRayWithIgnoreList(Ray.new(b,W.unit*(X or 999.999)),A)end function ToggleLights()for b,W in pairs(Lights:GetChildren())do if W:IsA("\066\097\115\101\080\097\114\116")then for b,W in pairs(W:GetChildren())do if W:IsA("\076\105\103\104\116")then W.Enabled=LightsEnabled end end end end end ToggleLights()function CheckTable(b,W)for b,X in pairs(b)do if X==W then return true end end return false end function RandomizeTable(b)local W={}for X=1,#b,1 do local A=math.random(1,#b)table.insert(W,b[A])table.remove(b,A)end return W end for b,W in pairs(Model:GetChildren())do if W:IsA("\066\097\115\101\080\097\114\116")and W.Name=="\066\101\097\109"then W:Destroy()end end function GetPartsInBeam(b)local W={(PlayerUsing and PlayerUsing.Character)and PlayerUsing.Character or nil,Model}local X=Vector3.new(b.Size.X/2,(CurrentBeamSize/5)/2,b.Size.Z/2)local A=Vector3.new(b.Size.X/2,(CurrentBeamSize/5)/2,b.Size.Z/2)local y=(game:GetService("\087\111\114\107\115\112\097\099\101")):FindPartsInRegion3WithIgnoreList(Region3.new(b.Position-X,b.Position+A),W,100)local T={}local m={}for b,W in pairs(y)do if W and W.Parent then local b=W.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")local X=W.Parent:FindFirstChild("\084\111\114\115\111")local A=Players:GetPlayerFromCharacter(W.Parent)if A and(b and(b.Health>0 and(X and not CheckTable(T,b))))then table.insert(T,b)table.insert(m,{Humanoid=b;Torso=X})end end end return m end RemoteConnection.OnServerInvoke=function(b,W,X,A)if W and W~=PlayerControlScript then W.Disabled=true W:Destroy()else if X=="\075\101\121\068\111\119\110"then if A=="\108"then LightsEnabled=not LightsEnabled ToggleLights()elseif A=="\116"then if TemporaryBeam and TemporaryBeam.Parent then local b=GetPartsInBeam(TemporaryBeam)local W={}b=RandomizeTable(b)for X,A in pairs(Seats:GetChildren())do if A:IsA("\083\101\097\116")and not A:FindFirstChild("\083\101\097\116\087\101\108\100")then for b,X in pairs(b)do if X.Humanoid and(X.Humanoid.Parent and(X.Humanoid.Health>0 and(not X.Humanoid.Sit and(X.Torso and(X.Torso.Parent and not CheckTable(W,X.Torso))))))then table.insert(W,X.Torso)X.Torso.CFrame=A.CFrame break end end end end end end if not TakingOff then for b,W in pairs(Controls)do if string.lower(W.Key)==string.lower(A)or W.Byte==string.byte(A)then W.Mode=true end end if Controls.Up.Mode or Controls.Down.Mode then RiseVelocity.maxForce=Vector3.new(0,1000000,0)end if Controls.Forward.Mode or Controls.Backward.Mode or Controls.Left.Mode or Controls.Right.Mode or Controls.Up.Mode or Controls.Down.Mode then Sounds.Idle:Stop()Sounds.Flying:Play()end end elseif X=="\075\101\121\085\112"then if not TakingOff then for b,W in pairs(Controls)do if string.lower(W.Key)==string.lower(A)or W.Byte==string.byte(A)then W.Mode=false end end if not Controls.Up.Mode and not Controls.Down.Mode then BodyPosition.position=Engine.Position BodyPosition.maxForce=Vector3.new(0,100000000,0)RiseVelocity.maxForce=Vector3.new(0,0,0)RiseVelocity.velocity=Vector3.new(0,0,0)end if not Controls.Forward.Mode and(not Controls.Backward.Mode and(not Controls.Left.Mode and(not Controls.Right.Mode and(not Controls.Up.Mode and not Controls.Down.Mode))))then Sounds.Flying:Stop()Sounds.Idle:Play()end end elseif X=="\066\117\116\116\111\110\049\068\111\119\110"then if not BeamActive and not TakingOff then BeamActive=true if TemporaryBeam and TemporaryBeam.Parent then TemporaryBeam:Destroy()end TemporaryBeam=Beam:Clone()TemporaryBeam.Parent=Model Spawn(function()while TemporaryBeam and TemporaryBeam.Parent do local b=GetPartsInBeam(TemporaryBeam)for b,W in pairs(b)do if W.Humanoid and(W.Humanoid.Parent and(W.Humanoid.Health>0 and(W.Torso and(W.Torso.Parent and(not W.Torso:FindFirstChild("\085\070\079\080\117\108\108\070\111\114\099\101")and not W.Torso:FindFirstChild("\085\070\079\066\097\108\097\110\099\101\070\111\114\099\101"))))))then local b=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")b.Name="\085\070\079\080\117\108\108\070\111\114\099\101"b.maxForce=Vector3.new(0,1000000,0)b.velocity=(CFrame.new(W.Torso.Position,BeamPart.Position)).lookVector*25 Debris:AddItem(b,.25)b.Parent=W.Torso local X=Instance.new("\066\111\100\121\071\121\114\111")X.Name="\085\070\079\066\097\108\097\110\099\101\070\111\114\099\101"X.maxTorque=Vector3.new(1000000,0,1000000)Debris:AddItem(X,.25)X.Parent=W.Torso end end wait()end end)local b=Instance.new("\087\101\108\100")b.Part0=BeamPart b.Part1=TemporaryBeam Spawn(function()Sounds.Beam:Play()while Enabled and(BeamActive and(TemporaryBeam and TemporaryBeam.Parent))do local W={Model}for b,X in pairs(Players:GetChildren())do if X:IsA("\080\108\097\121\101\114")and X.Character then table.insert(W,X.Character)end end local X=BeamPart:Clone()local A=X:Clone()A.CFrame=A.CFrame*CFrame.Angles(-math.rad(90),0,0)A.CFrame=A.CFrame-A.CFrame.lookVector*(BeamPart.Size.Y/2)local y,T=RayCast(BeamPart.Position,A.CFrame.lookVector,BeamSize,W)CurrentBeamSize=(BeamPart.Position-T).magnitude*5 TemporaryBeam.Mesh.Scale=Vector3.new(1,CurrentBeamSize,1)b.Parent=TemporaryBeam b.C0=CFrame.new(0,0,0)-Vector3.new(0,(CurrentBeamSize/2+BeamPart.Size.Y/2)/5,0)wait()end BeamActive=false Sounds.Beam:Stop()if TemporaryBeam and TemporaryBeam.Parent then TemporaryBeam:Destroy()end end)end elseif X=="\066\117\116\116\111\110\049\085\112"then BeamActive=false end end end function ManageMotionStep(b,W)local X=-W:vectorToWorldSpace(Vector3.new(0,0,1))local A=-W:vectorToWorldSpace(Vector3.new(1,0,0))local y=-W:vectorToWorldSpace(Vector3.new(0,1,0))X=X*Vector3.new(1,0,1)A=A*Vector3.new(1,0,1)if X:Dot(X)<.1 or A:Dot(A)<.1 then return end X=X.unit A=A.unit if math.abs(Velocity.X)<2 and math.abs(Velocity.Z)<2 then BodyVelocity.velocity=Vector3.new(0,0,0)else BodyVelocity.velocity=Velocity end BodyGyro.cframe=CFrame.new(0,0,0)*CFrame.Angles(Velocity:Dot(Vector3.new(0,0,1))*(math.pi/320),0,math.pi-Velocity:Dot(Vector3.new(1,0,0))*(math.pi/320))if Controls.Forward.Mode and(not Controls.Backward.Mode and Velocity:Dot(X)<MaxVelocity)then Velocity=Velocity+Acceleration*X elseif Controls.Backward.Mode and(not Controls.Forward.Mode and Velocity:Dot(X)>MinVelocity)then Velocity=Velocity-Deceleration*X elseif not Controls.Backward.Mode and(not Controls.Forward.Mode and Velocity:Dot(X)>0)then Velocity=Velocity-AutoDeceleration*X elseif not Controls.Backward.Mode and(not Controls.Forward.Mode and Velocity:Dot(X)<0)then Velocity=Velocity+AutoDeceleration*X end if Controls.Left.Mode and(not Controls.Right.Mode and Velocity:Dot(A)<MaxSideVelocity)then Velocity=Velocity+SideAcceleration*A elseif Controls.Right.Mode and(not Controls.Left.Mode and Velocity:Dot(A)>MinSideVelocity)then Velocity=Velocity-SideDeceleration*A elseif not Controls.Right.Mode and(not Controls.Left.Mode and Velocity:Dot(A)>0)then Velocity=Velocity-AutoSideDeceleration*A elseif not Controls.Right.Mode and(not Controls.Left.Mode and Velocity:Dot(A)<0)then Velocity=Velocity+AutoSideDeceleration*A end if b then RiseVelocity.velocity=Vector3.new(0,LiftOffSpeed,0)else if Controls.Up.Mode and not Controls.Down.Mode then RiseVelocity.velocity=Vector3.new(0,LiftSpeed,0)BodyPosition.maxForce=Vector3.new(0,0,0)elseif Controls.Down.Mode and not Controls.Up.Mode then RiseVelocity.velocity=Vector3.new(0,LowerSpeed,0)BodyPosition.maxForce=Vector3.new(0,0,0)end end end function MotionManager()Spawn(function()TakingOff=true RiseVelocity.maxForce=Vector3.new(0,1000000,0)local b=tick()Sounds.TakingOff:Play()while Enabled and(PlayerConnection and tick()-b<3)do local b=PlayerConnection:InvokeClient(PlayerUsing,"\067\111\111\114\100\105\110\097\116\101\070\114\097\109\101")ManageMotionStep(true,b)wait()end TakingOff=false Sounds.TakingOff:Stop()while PlayerConnection and(Enabled or Velocity:Dot(Velocity)>.5)do local b=PlayerConnection:InvokeClient(PlayerUsing,"\067\111\111\114\100\105\110\097\116\101\070\114\097\109\101")ManageMotionStep(false,b)wait()end end)end function LiftOff()BodyGyro.maxTorque=Vector3.new(1000000,1000000,1000000)BodyVelocity.maxForce=Vector3.new(1000000,0,1000000)Velocity=Vector3.new(0,0,0)Enabled=true MotionManager()end function Equipped(b)local W=b:FindFirstChild("\066\097\099\107\112\097\099\107")if W then InUse=true PlayerUsing=b PlayerControlScript=ControlScript:Clone()local X=Instance.new("\079\098\106\101\099\116\086\097\108\117\101")X.Name="\082\101\109\111\116\101\067\111\110\116\114\111\108\108\101\114"X.Value=RemoteConnection X.Parent=PlayerControlScript local A=Instance.new("\079\098\106\101\099\116\086\097\108\117\101")A.Name="\086\101\104\105\099\108\101\083\101\097\116"A.Value=Seat A.Parent=PlayerControlScript PlayerConnection=Instance.new("\082\101\109\111\116\101\070\117\110\099\116\105\111\110")PlayerConnection.Name="\080\108\097\121\101\114\067\111\110\110\101\099\116\105\111\110"PlayerConnection.Parent=PlayerControlScript PlayerControlScript.Disabled=false PlayerControlScript.Parent=W LiftOff()end end function Unequipped()if PlayerControlScript and PlayerControlScript.Parent then PlayerControlScript:Destroy()end Enabled=false PlayerControlScript=nil PlayerUsing=nil PlayerConnection=nil BeamActive=false TakingOff=false InUse=false BodyGyro.maxTorque=Vector3.new(0,0,0)BodyPosition.maxForce=Vector3.new(0,0,0)BodyVelocity.maxForce=Vector3.new(0,0,0)BodyVelocity.velocity=Vector3.new(0,0,0)RiseVelocity.maxForce=Vector3.new(0,0,0)RiseVelocity.velocity=Vector3.new(0,0,0)for b,W in pairs(Controls)do W.Mode=false end end function Flip()local b=Engine:Clone()b.CFrame=b.CFrame*CFrame.Angles(-math.rad(90),0,0)if b.CFrame.lookVector.Y<.707 then FlipGyro.cframe=CFrame.new(Vector3.new(0,0,0),Vector3.new(0,1,0))*CFrame.Angles(-math.pi/2,0,0)FlipGyro.maxTorque=Vector3.new(FlipForce,FlipForce,FlipForce)wait(2)FlipGyro.maxTorque=Vector3.new(0,0,0)end end Seat.ChildAdded:connect(function(b)if b:IsA("\087\101\108\100")and b.Name=="\083\101\097\116\087\101\108\100"then if b.Part0 and(b.Part0==Seat and(b.Part1 and b.Part1.Parent))then local W=Players:GetPlayerFromCharacter(b.Part1.Parent)if W then Equipped(W)end end end end)Seat.ChildRemoved:connect(function(b)if b:IsA("\087\101\108\100")and b.Name=="\083\101\097\116\087\101\108\100"then if b.Part0 and(b.Part0==Seat and(b.Part1 and b.Part1.Parent))then local W=Players:GetPlayerFromCharacter(b.Part1.Parent)if W and W==PlayerUsing then Unequipped(W)end end end end)Spawn(function()while true do Flip()wait(5)end end)


Seat = script.Parent
Model = Seat.Parent

Engine = Model:WaitForChild("Engine")
BeamPart = Model:WaitForChild("BeamPart")
Lights = Model:WaitForChild("Lights")
Seats = Model:WaitForChild("Seats")

Sounds = {
	Flying = Engine:WaitForChild("UFO_Flying"),
	Beam = Engine:WaitForChild("UFO_Beam"),
	Idle = Engine:WaitForChild("UFO_Idle"),
	TakingOff = Engine:WaitForChild("UFO_Taking_Off")
}

Players = game:GetService("Players")
Debris = game:GetService("Debris")

BeamSize = 50
CurrentBeamSize = 0

MaxVelocity = 40
MinVelocity = -40

MaxSideVelocity = 40
MinSideVelocity = -40

Acceleration = 2
Deceleration = 2
AutoDeceleration = 2

SideAcceleration = 2
SideDeceleration = 2
AutoSideDeceleration = 2

LiftOffSpeed = 5
LiftSpeed = 10
LowerSpeed = -10

Velocity = Vector3.new(0, 0, 0)
SideVelocity = 0

FlipForce = 1000000

InUse = false
PlayerUsing = nil
PlayerControlScript = nil
PlayerConnection = nil
BeamActive = false
TakingOff = false

LightsEnabled = false

Enabled = false

Controls = {
	Forward = {Key = "W", Byte = 17, Mode = false},
	Backward = {Key = "S", Byte = 18, Mode = false},
	Left = {Key = "A", Byte = 20, Mode = false},
	Right = {Key = "D", Byte = 19, Mode = false},
	Up = {Key = "Q", Byte = 113, Mode = false},
	Down = {Key = "E", Byte = 101, Mode = false},
}

ControlScript = script:WaitForChild("ControlScript")

Beam = Instance.new("Part")
Beam.Name = "Beam"
Beam.Transparency = 0.3
Beam.BrickColor = BrickColor.new("Pastel Blue")
Beam.Material = Enum.Material.Plastic
Beam.Shape = Enum.PartType.Block
Beam.TopSurface = Enum.SurfaceType.Smooth
Beam.BottomSurface = Enum.SurfaceType.Smooth
Beam.FormFactor = Enum.FormFactor.Custom
Beam.Size = Vector3.new(BeamPart.Size.X, 0.2, BeamPart.Size.Z)
Beam.Anchored = false
Beam.CanCollide = false
BeamMesh = Instance.new("CylinderMesh")
BeamMesh.Parent = Beam
script.Parent.Parent.BeamPart.SpotLight.Enabled = true

for i, v in pairs(Sounds) do
	v:Stop()
end

RemoteConnection = script:FindFirstChild("RemoteConnection")
if not RemoteConnection then
	RemoteConnection = Instance.new("RemoteFunction")
	RemoteConnection.Name = "RemoteConnection"
	RemoteConnection.Parent = script
end

BodyGyro = Engine:FindFirstChild("BodyGyro")
if not BodyGyro then
	BodyGyro = Instance.new("BodyGyro")
	BodyGyro.Parent = Engine
end
BodyGyro.maxTorque = Vector3.new(0, 0, 0)
BodyGyro.D = 7500
BodyGyro.P = 10000

BodyPosition = Engine:FindFirstChild("BodyPosition")
if not BodyPosition then
	BodyPosition = Instance.new("BodyPosition")
	BodyPosition.Parent = Engine
end
BodyPosition.maxForce = Vector3.new(0, 0, 0)
BodyPosition.D = 10000
BodyPosition.P = 50000

BodyVelocity = Engine:FindFirstChild("BodyVelocity")
if not BodyVelocity then
	BodyVelocity = Instance.new("BodyVelocity")
	BodyVelocity.Parent = Engine
end
BodyVelocity.velocity = Vector3.new(0, 0, 0)
BodyVelocity.maxForce = Vector3.new(0, 0, 0)
BodyVelocity.P = 10000

FlipGyro = BeamPart:FindFirstChild("FlipGyro")
if not FlipGyro then
	FlipGyro = Instance.new("BodyGyro")
	FlipGyro.Name = "FlipGyro"
	FlipGyro.Parent = BeamPart
end
FlipGyro.maxTorque = Vector3.new(0, 0, 0)
FlipGyro.D = 500
FlipGyro.P = 3000

RiseVelocity = BeamPart:FindFirstChild("RiseVelocity")
if not RiseVelocity then
	RiseVelocity = Instance.new("BodyVelocity")
	RiseVelocity.Name = "RiseVelocity"
	RiseVelocity.Parent = BeamPart
end
RiseVelocity.velocity = Vector3.new(0, 0, 0)
RiseVelocity.maxForce = Vector3.new(0, 0, 0)
RiseVelocity.P = 10000

function RayCast(Position, Direction, MaxDistance, IgnoreList)
	return game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(Position, Direction.unit * (MaxDistance or 999.999)), IgnoreList) 
end

function ToggleLights()
	for i, v in pairs(Lights:GetChildren()) do
		if v:IsA("BasePart") then
			for ii, vv in pairs(v:GetChildren()) do
				if vv:IsA("Light") then
					vv.Enabled = LightsEnabled
				end
			end
		end
	end
end

ToggleLights()

function CheckTable(Table, Instance)
	for i, v in pairs(Table) do
		if v == Instance then
			return true
		end
	end
	return false
end

function RandomizeTable(Table)
	local TableCopy = {}
	for i = 1, #Table do
		local Index = math.random(1, #Table)
		table.insert(TableCopy, Table[Index])
		table.remove(Table, Index)
	end
	return TableCopy
end

for i, v in pairs(Model:GetChildren()) do
	if v:IsA("BasePart") and v.Name == "Beam" then
		v:Destroy()
	end
end

function GetPartsInBeam(beam)
	local IgnoreObjects = {(((PlayerUsing and PlayerUsing.Character) and PlayerUsing.Character) or nil), Model}
	local NegativePartRadius = Vector3.new((beam.Size.X / 2), ((CurrentBeamSize / 5) / 2), (beam.Size.Z / 2))
	local PositivePartRadius = Vector3.new((beam.Size.X / 2), ((CurrentBeamSize / 5) / 2), (beam.Size.Z / 2))
	local Parts = game:GetService("Workspace"):FindPartsInRegion3WithIgnoreList(Region3.new(beam.Position - NegativePartRadius, beam.Position + PositivePartRadius), IgnoreObjects, 100)
	local Humanoids = {}
	local Torsos = {}
	for i, v in pairs(Parts) do
		if v and v.Parent then
			local humanoid = v.Parent:FindFirstChild("Humanoid")
			local torso = v.Parent:FindFirstChild("Torso")
			local player = Players:GetPlayerFromCharacter(v.Parent)
			if player and humanoid and humanoid.Health > 0 and torso and not CheckTable(Humanoids, humanoid) then
				table.insert(Humanoids, humanoid)
				table.insert(Torsos, {Humanoid = humanoid, Torso = torso})
			end
		end
	end
	return Torsos
end

RemoteConnection.OnServerInvoke = (function(Player, Script, Action, Value)
	if Script and Script ~= PlayerControlScript then
		Script.Disabled = true
		Script:Destroy()
	else
		if Action == "KeyDown" then
			if Value == "l" then
				LightsEnabled = not LightsEnabled
				ToggleLights()
			elseif Value == "t" then
				if TemporaryBeam and TemporaryBeam.Parent then
					local Torsos = GetPartsInBeam(TemporaryBeam)
					local TorsosUsed = {}
					Torsos = RandomizeTable(Torsos)
					for i, v in pairs(Seats:GetChildren()) do
						if v:IsA("Seat") and not v:FindFirstChild("SeatWeld") then
							for ii, vv in pairs(Torsos) do
								if vv.Humanoid and vv.Humanoid.Parent and vv.Humanoid.Health > 0 and not vv.Humanoid.Sit and vv.Torso and vv.Torso.Parent and not CheckTable(TorsosUsed, vv.Torso) then
									table.insert(TorsosUsed, vv.Torso)
									vv.Torso.CFrame = v.CFrame
									break
								end
							end
						end
					end
				end
			end
			if not TakingOff then
				for i, v in pairs(Controls) do
					if string.lower(v.Key) == string.lower(Value) or v.Byte == string.byte(Value) then
						v.Mode = true
					end
				end
				if Controls.Up.Mode or Controls.Down.Mode then
					RiseVelocity.maxForce = Vector3.new(0, 1000000, 0)
				end
				if Controls.Forward.Mode or Controls.Backward.Mode or Controls.Left.Mode or Controls.Right.Mode or Controls.Up.Mode or Controls.Down.Mode then
					Sounds.Idle:Stop()
					Sounds.Flying:Play()
				end
			end
		elseif Action == "KeyUp" then
			if not TakingOff then
				for i, v in pairs(Controls) do
					if string.lower(v.Key) == string.lower(Value) or v.Byte == string.byte(Value) then
						v.Mode = false
					end
				end
				if not Controls.Up.Mode and not Controls.Down.Mode then
					BodyPosition.position = Engine.Position
					BodyPosition.maxForce = Vector3.new(0, 100000000, 0)
					RiseVelocity.maxForce = Vector3.new(0, 0, 0)
					RiseVelocity.velocity = Vector3.new(0, 0, 0)
				end
				if not Controls.Forward.Mode and not Controls.Backward.Mode and not Controls.Left.Mode and not Controls.Right.Mode and not Controls.Up.Mode and not Controls.Down.Mode then
					Sounds.Flying:Stop()
					Sounds.Idle:Play()
				end
			end
		elseif Action == "Button1Down" then
			if not BeamActive and not TakingOff then
				BeamActive = true
				if TemporaryBeam and TemporaryBeam.Parent then
					TemporaryBeam:Destroy()
				end
				TemporaryBeam = Beam:Clone()
				TemporaryBeam.Parent = Model
				Spawn(function()
					while TemporaryBeam and TemporaryBeam.Parent do
						local Torsos = GetPartsInBeam(TemporaryBeam)
						for i, v in pairs(Torsos) do
							if v.Humanoid and v.Humanoid.Parent and v.Humanoid.Health > 0 and v.Torso and v.Torso.Parent and not v.Torso:FindFirstChild("UFOPullForce") and not v.Torso:FindFirstChild("UFOBalanceForce") then
								local UFOPullForce = Instance.new("BodyVelocity")
								UFOPullForce.Name = "UFOPullForce"
								UFOPullForce.maxForce = Vector3.new(0, 1000000, 0)
								UFOPullForce.velocity = CFrame.new(v.Torso.Position, BeamPart.Position).lookVector * 25
								Debris:AddItem(UFOPullForce, 0.25)
								UFOPullForce.Parent = v.Torso
								local UFOBalanceForce = Instance.new("BodyGyro")
								UFOBalanceForce.Name = "UFOBalanceForce"
								UFOBalanceForce.maxTorque = Vector3.new(1000000, 0, 1000000)
								Debris:AddItem(UFOBalanceForce, 0.25)
								UFOBalanceForce.Parent = v.Torso
							end
						end
						wait()
					end
				end)
				local BeamWeld = Instance.new("Weld")
				BeamWeld.Part0 = BeamPart
				BeamWeld.Part1 = TemporaryBeam
				Spawn(function()
					Sounds.Beam:Play()
					while Enabled and BeamActive and TemporaryBeam and TemporaryBeam.Parent do
						local IgnoreTable = {Model}
						for i, v in pairs(Players:GetChildren()) do
							if v:IsA("Player") and v.Character then
								table.insert(IgnoreTable, v.Character)
							end
						end
						local BeamPartClone = BeamPart:Clone()
						local BeamPartCloneY = BeamPartClone:Clone()
						BeamPartCloneY.CFrame = BeamPartCloneY.CFrame * CFrame.Angles(-math.rad(90), 0, 0)		
						BeamPartCloneY.CFrame = BeamPartCloneY.CFrame - BeamPartCloneY.CFrame.lookVector * ((BeamPart.Size.Y / 2))
						local Hit, Position = RayCast(BeamPart.Position, BeamPartCloneY.CFrame.lookVector, BeamSize, IgnoreTable)
						CurrentBeamSize = ((BeamPart.Position - Position).magnitude * 5)
						TemporaryBeam.Mesh.Scale = Vector3.new(1, CurrentBeamSize, 1)
						BeamWeld.Parent = TemporaryBeam
						BeamWeld.C0 = CFrame.new(0, 0, 0) - Vector3.new(0, ((CurrentBeamSize / 2) + (BeamPart.Size.Y / 2)) / 5 , 0)
						wait()
					end
					BeamActive = false
					Sounds.Beam:Stop()
					if TemporaryBeam and TemporaryBeam.Parent then
						TemporaryBeam:Destroy()
					end
				end)
			end
		elseif Action == "Button1Up" then
			BeamActive = false
		end
	end
end)

function ManageMotionStep(ForceLift, CoordinateFrame)
	
	local CameraForwards = -CoordinateFrame:vectorToWorldSpace(Vector3.new(0, 0, 1))
	local CameraSideways = -CoordinateFrame:vectorToWorldSpace(Vector3.new(1, 0, 0))
	local CameraRotation = -CoordinateFrame:vectorToWorldSpace(Vector3.new(0, 1, 0))

	CameraForwards = CameraForwards * Vector3.new(1, 0, 1)
	CameraSideways = CameraSideways * Vector3.new(1, 0, 1)

	if CameraForwards:Dot(CameraForwards) < 0.1 or CameraSideways:Dot(CameraSideways) < 0.1 then
		return
	end
	
	CameraForwards = CameraForwards.unit
	CameraSideways = CameraSideways.unit

	if math.abs(Velocity.X) < 2 and math.abs(Velocity.Z) < 2 then
		BodyVelocity.velocity = Vector3.new(0, 0, 0)
	else
		BodyVelocity.velocity = Velocity
	end
	BodyGyro.cframe = CFrame.new(0, 0, 0) * CFrame.Angles(Velocity:Dot(Vector3.new(0, 0, 1)) * (math.pi / 320), 0, math.pi - Velocity:Dot(Vector3.new(1, 0, 0)) * (math.pi / 320))
	if Controls.Forward.Mode and (not Controls.Backward.Mode) and Velocity:Dot(CameraForwards) < MaxVelocity then
		Velocity = Velocity + Acceleration * CameraForwards
	elseif Controls.Backward.Mode and (not Controls.Forward.Mode) and Velocity:Dot(CameraForwards) > MinVelocity then
		Velocity = Velocity - Deceleration * CameraForwards
	elseif (not Controls.Backward.Mode) and (not Controls.Forward.Mode) and Velocity:Dot(CameraForwards) > 0 then
		Velocity = Velocity - AutoDeceleration * CameraForwards
	elseif (not Controls.Backward.Mode) and (not Controls.Forward.Mode) and Velocity:Dot(CameraForwards) < 0 then
		Velocity = Velocity + AutoDeceleration * CameraForwards
	end

	if Controls.Left.Mode and (not Controls.Right.Mode) and Velocity:Dot(CameraSideways) < MaxSideVelocity then
		Velocity = Velocity + SideAcceleration * CameraSideways
	elseif Controls.Right.Mode and (not Controls.Left.Mode) and Velocity:Dot(CameraSideways) > MinSideVelocity then
		Velocity = Velocity - SideDeceleration * CameraSideways
	elseif (not Controls.Right.Mode) and (not Controls.Left.Mode) and Velocity:Dot(CameraSideways) > 0 then
		Velocity = Velocity - AutoSideDeceleration * CameraSideways
	elseif (not Controls.Right.Mode) and (not Controls.Left.Mode) and Velocity:Dot(CameraSideways) < 0 then
		Velocity = Velocity + AutoSideDeceleration * CameraSideways
	end

	if ForceLift then
		RiseVelocity.velocity = Vector3.new(0, LiftOffSpeed, 0)
	else
		if Controls.Up.Mode and (not Controls.Down.Mode) then
			RiseVelocity.velocity = Vector3.new(0, LiftSpeed, 0)
			BodyPosition.maxForce = Vector3.new(0, 0, 0)
		elseif Controls.Down.Mode and (not Controls.Up.Mode) then
			RiseVelocity.velocity = Vector3.new(0, LowerSpeed, 0)
			BodyPosition.maxForce = Vector3.new(0, 0, 0)
		end
	end
	
end

function MotionManager()
	Spawn(function()
		TakingOff = true
		RiseVelocity.maxForce = Vector3.new(0, 1000000, 0)
		local StartTime = tick()
		Sounds.TakingOff:Play()
		while Enabled and PlayerConnection and (tick() - StartTime) < 3 do
			local CoordinateFrame = PlayerConnection:InvokeClient(PlayerUsing, "CoordinateFrame")
			ManageMotionStep(true, CoordinateFrame)
			wait()
		end
		TakingOff = false
		Sounds.TakingOff:Stop()
		while PlayerConnection and (Enabled or Velocity:Dot(Velocity) > 0.5) do
			local CoordinateFrame = PlayerConnection:InvokeClient(PlayerUsing, "CoordinateFrame")
			ManageMotionStep(false, CoordinateFrame)
			wait()
		end
	end)
end

function LiftOff()
	
	BodyGyro.maxTorque = Vector3.new(1000000, 1000000, 1000000)
	BodyVelocity.maxForce = Vector3.new(1000000, 0, 1000000)
	
	Velocity = Vector3.new(0, 0, 0)

	Enabled = true
	
	MotionManager()

end

function Equipped(Player)
	local Backpack = Player:FindFirstChild("Backpack")
	if Backpack then
		InUse = true
		PlayerUsing = Player
		PlayerControlScript = ControlScript:Clone()
		local RemoteController = Instance.new("ObjectValue")
		RemoteController.Name = "RemoteController"
		RemoteController.Value = RemoteConnection
		RemoteController.Parent = PlayerControlScript
		local VehicleSeat = Instance.new("ObjectValue")
		VehicleSeat.Name = "VehicleSeat"
		VehicleSeat.Value = Seat
		VehicleSeat.Parent = PlayerControlScript
		PlayerConnection = Instance.new("RemoteFunction")
		PlayerConnection.Name = "PlayerConnection"
		PlayerConnection.Parent = PlayerControlScript
		PlayerControlScript.Disabled = false
		PlayerControlScript.Parent = Backpack
		LiftOff()
	end
end

function Unequipped()
	if PlayerControlScript and PlayerControlScript.Parent then
		PlayerControlScript:Destroy()
	end
	Enabled = false
	PlayerControlScript = nil
	PlayerUsing = nil
	PlayerConnection = nil
	BeamActive = false
	TakingOff = false
	InUse = false
	BodyGyro.maxTorque = Vector3.new(0, 0, 0)
	BodyPosition.maxForce = Vector3.new(0, 0, 0)
	BodyVelocity.maxForce = Vector3.new(0, 0, 0)
	BodyVelocity.velocity = Vector3.new(0, 0, 0)
	RiseVelocity.maxForce = Vector3.new(0, 0, 0)
	RiseVelocity.velocity = Vector3.new(0, 0, 0)
	for i, v in pairs(Controls) do
		v.Mode = false
	end
end

function Flip()
	local EngineCloneY = Engine:Clone()
	EngineCloneY.CFrame = EngineCloneY.CFrame * CFrame.Angles(-math.rad(90), 0, 0)
	if EngineCloneY.CFrame.lookVector.Y < 0.707 then
		FlipGyro.cframe = CFrame.new(Vector3.new(0, 0, 0), Vector3.new(0, 1, 0)) * CFrame.Angles((-math.pi / 2), 0, 0)
		FlipGyro.maxTorque = Vector3.new(FlipForce, FlipForce, FlipForce)
		wait(2)
		FlipGyro.maxTorque = Vector3.new(0,0,0)
	end
end

Seat.ChildAdded:connect(function(Child)
	if Child:IsA("Weld") and Child.Name == "SeatWeld" then
		if Child.Part0 and Child.Part0 == Seat and Child.Part1 and Child.Part1.Parent then
			local Player = Players:GetPlayerFromCharacter(Child.Part1.Parent)
			if Player then
				Equipped(Player)
			end
		end
	end
end)

Seat.ChildRemoved:connect(function(Child)
	if Child:IsA("Weld") and Child.Name == "SeatWeld" then
		if Child.Part0 and Child.Part0 == Seat and Child.Part1 and Child.Part1.Parent then
			local Player = Players:GetPlayerFromCharacter(Child.Part1.Parent)
			if Player and Player == PlayerUsing then
				Unequipped(Player)
			end
		end
	end
end)

Spawn(function()
	while true do
		Flip()
		wait(5)
	end
end)