Advertisement
danielaust

Better heli

Apr 16th, 2019
208
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 print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end
  6.  
  7. --Ok Guys, I Changed My Mind, I Will Keep It Up Forever
  8. --You don't need to put your name in anywhere, just run this local script
  9. --[[Helicopter - Made 100% by Ethancomputermad - Prototype
  10. THIS IS A LOCALSCRIPT
  11. COMMANDS:
  12. SAY EJECT TO EJECT YOUR PASSENGER
  13. SAY LEAVE TO GET OUT
  14. TO GET IN OR LET A PASSENGER IN APPROACH THE MIDDLE OF THE HELICOPTER
  15. ]]
  16. wait(1)
  17. speed = 1
  18. turnspeed = math.pi / 90
  19. vspeed = 1
  20. isinheli = true
  21. function loadheli()
  22. p = Instance.new("Part", game.Workspace)
  23. p.Name = game.Players.LocalPlayer.Name .. "Heli"
  24. p.Anchored = true
  25. p.CFrame = CFrame.new(game.Players.LocalPlayer.Character.Torso.CFrame.X, game.Players.LocalPlayer.Character.Torso.CFrame.Y, game.Players.LocalPlayer.Character.Torso.CFrame.Z) + Vector3.new(0, 30, 0)
  26. p.Size = Vector3.new(6, 2.4, 5)
  27. m = Instance.new("SpecialMesh", p)
  28. m.MeshType = Enum.MeshType.FileMesh
  29. m.MeshId = "http://www.roblox.com/asset/?id=70264208"
  30. m.Scale = Vector3.new(5, 5, 5)
  31. m.TextureId = "http://www.roblox.com/asset/?id=70264191"
  32. return p
  33. end
  34. pl = game.Players.LocalPlayer
  35. cam = game.Workspace.CurrentCamera
  36. mouse = pl:GetMouse()
  37. pcall(function() game.Workspace[pl.Name .. "Heli"]:Destroy() end)
  38. loadheli()
  39. heli = game.Workspace[pl.Name .. "Heli"]
  40. mf = false
  41. mb = false
  42. tl = false
  43. tr = false
  44. gu = false
  45. gd = false
  46. movement = coroutine.create(function(h) while true do wait() if isinheli == true then if mf == true then h.CFrame = h.CFrame * CFrame.new(0, 0, 0 - speed) end
  47. if mb == true then h.CFrame = h.CFrame * CFrame.new(0, 0, speed) end
  48. if tl == true then h.CFrame = h.CFrame * CFrame.Angles(0, turnspeed, 0) end
  49. if tr == true then h.CFrame = h.CFrame * CFrame.Angles(0, 0 - turnspeed, 0) end
  50. if gu == true then h.CFrame = h.CFrame + Vector3.new(0, vspeed, 0) end
  51. if gd == true then h.CFrame = h.CFrame + Vector3.new(0, 0 - vspeed, 0) end
  52. end
  53. end
  54. end)
  55. coroutine.resume(movement, heli)
  56. h = Instance.new("Hint", game.Workspace)
  57. h.Text = ""
  58. candosmoke = false
  59. spos = nil
  60. spos3 = nil
  61. pcall(function() spos = game.Workspace.Base.CFrame spos3 = game.Workspace.Base.Position base = game.Workspace.Base candosmoke = true end)
  62. if spos == nil then pcall(function() spos = game.Workspace["CLWorldFile - Really dont remove"].Base.CFrame spos3 = game.Workspace["CLWorldFile - Really dont remove"].Base.Position base = game.Workspace["CLWorldFile - Really dont remove"].Base candosmoke = true end) end
  63.  
  64. if candosmoke == false then else
  65. smoke = coroutine.create(function(h, b)
  66. for i= 1, 8 do p = Instance.new("Part", h) p.Anchored = true p.CanCollide = false p.Transparency = 1 p.Name = i .. "s" s = Instance.new("Smoke", p) s.Enabled = false s.RiseVelocity = 5 s.Opacity = 0.3 s.Color = Color3.new(153 / 255, 102 / 255, 51 / 255) s.Name = "S" end
  67. while true do wait() for i= 1, 8 do h[i .. "s"].CFrame = CFrame.new(Vector3.new(h.Position.x, b.Position.y, h.Position.z)) * CFrame.Angles(math.pi / 2, 0, math.pi / 4 * (i - 1)) end
  68. if h.Position.y < spos3.y + 15 then
  69. for i= 1, 8 do wait() h[i .. "s"]:GetChildren()[1].Enabled = true end else
  70. for i= 1, 8 do wait() h[i .. "s"]:GetChildren()[1].Enabled = false end end
  71. end end)
  72. coroutine.resume(smoke, heli, base)
  73. end
  74. mchar = coroutine.create(function(c)
  75. while true do wait() if isinheli == true then pcall(function()
  76. c.Torso.Anchored = true
  77. c.Torso.CFrame = heli.CFrame * CFrame.new(0, -1.8, -8)
  78. end) end end end)
  79. coroutine.resume(mchar, pl.Character)
  80. dawooh = coroutine.create(function()
  81. while true do wait() if isinheli == true then else
  82. mf = false
  83. mb = false
  84. tl = false
  85. tr = false
  86. gu = false
  87. gd = false
  88. ucs = false end end end)
  89. coroutine.resume(dawooh)
  90. cam.CameraSubject = heli
  91. cam.CameraType = Enum.CameraType.Track
  92. cam.FieldOfView = 80
  93. mouse.KeyDown:connect(function(key)
  94. k = string.byte(key)
  95. if k == 17 then --[[Up arrow]]
  96. mf = true
  97. end
  98. if k == 18 then --[[Down arrow]]
  99. mb = true
  100. end
  101. if k == 20 then --[[Left arrow]]
  102. tl = true
  103. end
  104. if k == 19 then --[[Right arrow]]
  105. tr = true
  106. end
  107. if key == "w" then
  108. gu = true
  109. end
  110. if key == "s" then
  111. gd = true
  112. end
  113. end)
  114.  
  115. mouse.KeyUp:connect(function(key)
  116. k = string.byte(key)
  117. if k == 17 then --[[Up arrow]]
  118. mf = false
  119. end
  120. if k == 18 then --[[Down arrow]]
  121. mb = false
  122. end
  123. if k == 20 then --[[Left arrow]]
  124. tl = false
  125. end
  126. if k == 19 then --[[Right arrow]]
  127. tr = false
  128. end
  129. if key == "w" then
  130. gu = false
  131. end
  132. if key == "s" then
  133. gd = false
  134. end
  135. end)
  136. occupied = false
  137. ucs = false
  138. heli.Touched:connect(function(c)
  139. if c.Parent.Name == pl.Name then
  140. isinheli = true
  141. else
  142. if occupied == false then else return end
  143. if c.Parent:FindFirstChild("Humanoid") ~= nil then else return end
  144. occupied = true
  145. ucs = true
  146. while ucs == true do wait()
  147. pcall(function() c.Parent.Torso.Anchored = true c.Parent.Torso.CFrame = heli.CFrame end) end
  148. pcall(function()
  149. c.Parent.Torso.CFrame = c.Parent.Torso.CFrame * CFrame.Angles(0, math.pi / 2, 0)
  150. c.Parent.Torso.CFrame = c.Parent.Torso.CFrame * CFrame.new(0, 0, 0 - 7)
  151. c.Parent.Torso.Anchored = false
  152. occupied = false
  153. end)
  154. end
  155. end)
  156.  
  157. pl.Chatted:connect(function(msg)
  158. lmsg = string.lower(msg)
  159. if lmsg == "eject" then ucs = false end
  160. if lmsg == "leave" then isinheli = false pl.Character.Torso.CFrame = pl.Character.Torso.CFrame * CFrame.Angles(0, math.pi / 2, 0) pl.Character.Torso.CFrame = pl.Character.Torso.CFrame * CFrame.new(0, 0, 0 - 5) pl.Character.Torso.Anchored = false
  161. cam.CameraSubject = pl.Character.Head
  162. cam.CameraType = Enum.CameraType.Track end
  163. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement