Gememed

FE Plane script but better

Jun 5th, 2019
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6.     print("FE Compatibility code V2 by Mokiros")
  7.     local RealPlayer = RealPlayer
  8.     script.Parent = RealPlayer.Character
  9.  
  10.     --Fake event to make stuff like Mouse.KeyDown work
  11.     local Disconnect_Function = function(this)
  12.         this[1].Functions[this[2]] = nil
  13.     end
  14.     local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  15.     local FakeEvent_Metatable = {__index={
  16.         Connect = function(this,f)
  17.             local i = tostring(math.random(0,10000))
  18.             while this.Functions[i] do
  19.                 i = tostring(math.random(0,10000))
  20.             end
  21.             this.Functions[i] = f
  22.             return setmetatable({this,i},Disconnect_Metatable)
  23.         end
  24.     }}
  25.     FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  26.     local function fakeEvent()
  27.         return setmetatable({Functions={}},FakeEvent_Metatable)
  28.     end
  29.  
  30.     --Creating fake input objects with fake variables
  31.     local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  32.     FakeMouse.keyUp = FakeMouse.KeyUp
  33.     FakeMouse.keyDown = FakeMouse.KeyDown
  34.     local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  35.     local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  36.         CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  37.     end}
  38.     --Merged 2 functions into one by checking amount of arguments
  39.     CAS.UnbindAction = CAS.BindAction
  40.  
  41.     --This function will trigger the events that have been :Connect()'ed
  42.     local function TriggerEvent(self,ev,...)
  43.         for _,f in pairs(self[ev].Functions) do
  44.             f(...)
  45.         end
  46.     end
  47.     FakeMouse.TriggerEvent = TriggerEvent
  48.     UIS.TriggerEvent = TriggerEvent
  49.  
  50.     --Client communication
  51.     local Event = Instance.new("RemoteEvent")
  52.     Event.Name = "UserInput_Event"
  53.     Event.OnServerEvent:Connect(function(plr,io)
  54.         if plr~=RealPlayer then return end
  55.         FakeMouse.Target = io.Target
  56.         FakeMouse.Hit = io.Hit
  57.         if not io.isMouse then
  58.             local b = io.UserInputState == Enum.UserInputState.Begin
  59.             if io.UserInputType == Enum.UserInputType.MouseButton1 then
  60.                 return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  61.             end
  62.             if io.UserInputType == Enum.UserInputType.MouseButton2 then
  63.                 return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  64.             end
  65.             for _,t in pairs(CAS.Actions) do
  66.                 for _,k in pairs(t.Keys) do
  67.                     if k==io.KeyCode then
  68.                         t.Function(t.Name,io.UserInputState,io)
  69.                     end
  70.                 end
  71.             end
  72.             FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  73.             UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  74.         end
  75.     end)
  76.     Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  77.     local Mouse = owner:GetMouse()
  78.     local UIS = game:GetService("UserInputService")
  79.     local input = function(io,RobloxHandled)
  80.         if RobloxHandled then return end
  81.         --Since InputObject is a client-side instance, we create and pass table instead
  82.         Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  83.     end
  84.     UIS.InputBegan:Connect(input)
  85.     UIS.InputEnded:Connect(input)
  86.     local h,t
  87.     --Give the server mouse data every second frame, but only if the values changed
  88.     --If player is not moving their mouse, client won't fire events
  89.     local HB = game:GetService("RunService").Heartbeat
  90.     while true do
  91.         if h~=Mouse.Hit or t~=Mouse.Target then
  92.             h,t=Mouse.Hit,Mouse.Target
  93.             Event:FireServer({isMouse=true,Target=t,Hit=h})
  94.         end
  95.         --Wait 2 frames
  96.         for i=1,2 do
  97.             HB:Wait()
  98.         end
  99.     end]==],script)
  100.  
  101.     ----Sandboxed game object that allows the usage of client-side methods and services
  102.     --Real game object
  103.     local RealGame = game
  104.  
  105.     --Metatable for fake service
  106.     local FakeService_Metatable = {
  107.         __index = function(self,k)
  108.             local s = rawget(self,"_RealService")
  109.             if s then
  110.                 return typeof(s[k])=="function"
  111.                 and function(_,...)return s[k](s,...)end or s[k]
  112.             end
  113.         end,
  114.         __newindex = function(self,k,v)
  115.             local s = rawget(self,"_RealService")
  116.             if s then s[k]=v end
  117.         end
  118.     }
  119.     local function FakeService(t,RealService)
  120.         t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  121.         return setmetatable(t,FakeService_Metatable)
  122.     end
  123.  
  124.     --Fake game object
  125.     local FakeGame = {
  126.         GetService = function(self,s)
  127.             return rawget(self,s) or RealGame:GetService(s)
  128.         end,
  129.         Players = FakeService({
  130.             LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  131.         },"Players"),
  132.         UserInputService = FakeService(UIS,"UserInputService"),
  133.         ContextActionService = FakeService(CAS,"ContextActionService"),
  134.         RunService = FakeService({
  135.             _btrs = {},
  136.             RenderStepped = RealGame:GetService("RunService").Heartbeat,
  137.             BindToRenderStep = function(self,name,_,fun)
  138.                 self._btrs[name] = self.Heartbeat:Connect(fun)
  139.             end,
  140.             UnbindFromRenderStep = function(self,name)
  141.                 self._btrs[name]:Disconnect()
  142.             end,
  143.         },"RunService")
  144.     }
  145.     rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  146.     FakeGame.service = FakeGame.GetService
  147.     FakeService(FakeGame,game)
  148.     --Changing owner to fake player object to support owner:GetMouse()
  149.     game,owner = FakeGame,FakeGame.Players.LocalPlayer
  150. end
  151. local char = game.Players.LocalPlayer.Character
  152.  
  153.  
  154. local player = game.Players.LocalPlayer
  155. repeat wait() until player.Character.Humanoid
  156. local humanoid = player.Character.Humanoid
  157. local mouse = player:GetMouse()
  158.  
  159. local weld = Instance.new("Weld",char.Torso)
  160. weld.Part0 = char.Torso
  161.  
  162. local plane = Instance.new("Part",char.Torso)
  163. plane.Anchored = false
  164. plane.CanCollide = false
  165. plane.Size = Vector3.new(3,2,6)
  166. plane.CustomPhysicalProperties = PhysicalProperties.new(0,0,0,0,0)
  167. weld.Part1 = plane
  168. weld.C1 = CFrame.new(0,0.5,0) * CFrame.Angles(0,math.rad(270),0)
  169.  
  170. local pf = Instance.new("ForceField")
  171. pf.Parent = game.Players.LocalPlayer.Character
  172.  
  173. for i,v in pairs(char.Torso:GetChildren()) do
  174.    if v.ClassName == 'Decal' then
  175.         v:Destroy()
  176.    end
  177. end
  178. for i,v in pairs(char:GetChildren()) do
  179.    if v.ClassName == 'Hat' then
  180.        v:Destroy()
  181.    end
  182. end
  183. for i,v in pairs(char.Head:GetChildren()) do
  184.    if v.ClassName == 'Decal' then
  185.        v:Destroy()
  186.    end
  187. end
  188.  
  189. char.Humanoid.JumpPower = 200
  190. char.Humanoid.Jump = true
  191.  
  192. local plane = Instance.new('SpecialMesh', plane)
  193. plane.MeshType = 'FileMesh'
  194. plane.MeshId = 'http://www.roblox.com/asset/?id=498194022' --498194022
  195. plane.TextureId = 'http://www.roblox.com/asset/?id=498194025'
  196. plane.Scale = Vector3.new(0.2, 0.2, 0.2)
  197.  
  198.  
  199. planesound=Instance.new('Sound', char.Torso)
  200. planesound.SoundId = 'rbxassetid://439771510'
  201. planesound.Volume = 1
  202. planesound.Looped = true
  203.  
  204. pullup=Instance.new('Sound', char.Torso)
  205. pullup.SoundId = 'rbxassetid://144560522'
  206. pullup.Volume = 10
  207. pullup.Looped = true
  208.  
  209. alarm=Instance.new('Sound', char.Torso)
  210. alarm.SoundId = 'rbxassetid://384231761'
  211. alarm.Volume = 10
  212. alarm.Looped = true
  213.  
  214.  
  215. screech=Instance.new('Sound', char.Torso)
  216. screech.SoundId = 'rbxassetid://262353320'
  217. screech.Volume = 10
  218.  
  219. st=Instance.new('Sound', char.Torso)
  220. st.SoundId = 'rbxassetid://131353021'
  221. st.Volume = 20
  222.  
  223. allahuakbar=Instance.new('Sound', char)
  224. allahuakbar.SoundId = 'rbxassetid://293292782'
  225. allahuakbar.Volume = 10
  226.  
  227. moosic=Instance.new('Sound', char)
  228. moosic.SoundId = 'rbxassetid://504630746'
  229. moosic.Volume = 2
  230.  
  231. allahuakbar2=Instance.new('Sound', char)
  232. allahuakbar2.SoundId = 'rbxassetid://446824013' --446824013
  233. allahuakbar2.Volume = 1
  234.  
  235.  
  236. planesound:Play()
  237.  
  238. explosionf=Instance.new('ParticleEmitter', char.Torso)
  239. explosionf.Texture = 'http://www.roblox.com/asset/?id=244514357'
  240. explosionf.Size = NumberSequence.new(19)
  241. explosionf.Rate = 1000
  242. explosionf.LightEmission = 0.4
  243. explosionf.Lifetime = NumberRange.new(1)
  244. explosionf.VelocitySpread = 360
  245. explosionf.Enabled = false
  246.  
  247.  
  248.  
  249. char.Torso.Transparency = 1
  250. char.Head.Transparency = 1
  251. char['Left Arm'].Transparency = 1
  252. char['Right Arm'].Transparency = 1
  253. char['Left Leg'].Transparency = 1
  254. char['Right Leg'].Transparency = 1
  255.  
  256. repeat wait(1)until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer:GetMouse() and game:FindService("Workspace") and game.Workspace.CurrentCamera
  257. local Me = game:GetService("Players").LocalPlayer
  258. local Char = Me.Character
  259. local Mouse = Me:GetMouse()
  260. local Cam = Workspace.CurrentCamera
  261. local Stop = false
  262. local Version = 0
  263. local MaxSpeed = 8
  264. local Speed = 8
  265. local Keys = {}
  266. local Force = 10000 -- 10000 = Fly, 1000000 = Noclip
  267.  
  268. local Fly, Rot = Char.Torso:FindFirstChild("LMMFly"), Char.Torso:FindFirstChild("LMMRot")
  269. if Fly then Fly:Destroy() end if Rot then Rot:Destroy() end
  270. Fly = Instance.new("BodyPosition", Char.Torso) Fly.Name = "LMMFly" Fly.maxForce = Vector3.new(math.huge, math.huge, math.huge) Fly.P = Force Fly.position = Char.Torso.Position
  271. Rot = Instance.new("BodyGyro", Char.Torso) Rot.Name = "LMMRot" Rot.maxTorque = Vector3.new(math.huge, math.huge, math.huge) Rot.P = Force Rot.cframe = Cam.CoordinateFrame
  272.  
  273. local Thread,Old = Version, nil
  274. Char.Humanoid.PlatformStand = true
  275.  
  276. function StopFly()
  277. Version = Version + 1 Stop = true Char.Humanoid.PlatformStand = false Fly:Destroy() Rot:Destroy() script.Disabled = true script:Destroy()
  278. end
  279.  
  280. Char.ChildAdded:connect(function(Obj) wait()
  281. if Obj.Name == "LM".."MFlyStop" then
  282. Obj:Destroy()
  283. StopFly()
  284. end
  285. end)
  286.  
  287. coroutine.wrap(function() while Thread == Version and Stop == false do
  288. local Vectoring = Rot.cframe - Rot.cframe.p + Fly.position
  289.  
  290. if Keys[string.char(48)] then Speed = 1 end
  291. if Keys.w then Vectoring = Vectoring + Cam.CoordinateFrame.lookVector * Speed end
  292. if Keys.s then Vectoring = Vectoring - Cam.CoordinateFrame.lookVector * Speed end
  293. if Keys.d then Vectoring = Vectoring * CFrame.new(Speed,0,0) end
  294. if Keys.a then Vectoring = Vectoring * CFrame.new(-Speed,0,0) end
  295. if Keys.e or Keys[" "] then Vectoring = Vectoring * CFrame.new(0,Speed,0) end
  296. if Keys.q then Vectoring = Vectoring * CFrame.new(0,-Speed,0) end
  297. if Keys.x then StopFly() end
  298.  
  299. if Old ~= Vectoring then
  300. Fly.position = Vectoring.p
  301. Old = Vectoring
  302. Speed = math.min(Speed + Speed*0.025,MaxSpeed)
  303. else
  304. Speed = 1;
  305. end
  306. Rot.cframe = Cam.CoordinateFrame
  307. wait(0.01)
  308. end end)()
  309.  
  310. Mouse.KeyDown:connect(function(Key)
  311. Keys[Key] = true
  312. end)
  313. Mouse.KeyUp:connect(function(Key)
  314. Keys[Key] = false
  315. end)
  316.  
  317.  
  318. mouse.KeyDown:connect(function(key)
  319. if key == "c" then
  320. planesound:Stop()
  321. screech:Play()
  322. allahuakbar2:Stop()
  323. pullup:Stop()
  324. explosionf.Enabled = false
  325. alarm:Stop()
  326. local e = Instance.new("Smoke", char.Torso)
  327. e.Size = 20
  328. char.Torso.Anchored = false
  329. wait(3)
  330. e.Enabled = false
  331.  
  332. end
  333. end)
  334.  
  335. mouse.KeyDown:connect(function(key)
  336. if key == "v" then
  337. explosionf.Enabled = true
  338. pullup:Play()
  339. alarm:Play()
  340. explosionf.Size = NumberSequence.new(5)
  341. end
  342. end)
  343.  
  344. mouse.KeyDown:connect(function(key)
  345. if key == "b" then
  346. moosic:Play()
  347. end
  348. end)
  349.  
  350. mouse.KeyDown:connect(function(key)
  351. if key == "n" then
  352. moosic:Stop()
  353. end
  354. end)
  355.  
  356. mouse.KeyDown:connect(function(key)
  357. if key == "z" then
  358. planesound:Play()
  359. screech:Stop()
  360. char.Torso.Anchored = false
  361. st:Play()
  362. allahuakbar2:Stop()
  363. pullup:Stop()
  364. explosionf.Enabled = false
  365. alarm:Stop()
  366.  
  367.  
  368. end
  369. end)
  370.  
  371. Enabled = false
  372. function onTouched(hit)
  373. if Enabled then
  374. return
  375. end
  376. Enabled=false
  377. local e = Instance.new("Explosion")
  378. e.BlastRadius = 99999999 --How much ground the explosion covers--
  379. e.BlastPressure = 99999999 --How powerful the explosion is--
  380. e.Parent = char.Torso --Don't change this!
  381. e.Position = char.Torso.Position --Don't change this!
  382. allahuakbar:Play()
  383. explosionf.Size = NumberSequence.new(50)
  384. explosionf.Speed = NumberRange.new(30)
  385. explosionf.Enabled = true
  386. char.Torso.Anchored = true
  387. explosionf.Lifetime = NumberRange.new(0.25)
  388. allahuakbar2:Play()
  389. allahuakbar2.Pitch = 0
  390. pullup:Stop()
  391. alarm:Stop()
  392. wait(1.25)
  393. allahuakbar2.Pitch = 0
  394. explosionf.Enabled = false
  395. planesound:Stop()
  396. wait(0.50)
  397. plr = game.Players.LocalPlayer.Name
  398. for i,v in pairs(game.Players:GetChildren()) do
  399.        if v.Name ~= plr then
  400. game:GetService("Chat"):Chat(v.Character.Head, "ALLAHU AKBAR!!! HEIL PLANE CRASHES!!!", Enum.ChatColor.Blue)
  401. AKBAR=Instance.new('Sound', v.Character.Head)
  402. AKBAR.SoundId = 'rbxassetid://396873260'
  403. AKBAR.Volume = 15
  404. AKBAR.Pitch = 0.25
  405. AKBAR.Looped = false
  406. AKBAR:Play()
  407. wait(2.6)
  408. AKBAR:Play()
  409.  
  410. end
  411. end
  412.  
  413. end
  414. char.Torso.Touched:connect(onTouched)
Add Comment
Please, Sign In to add comment