Advertisement
sIendytubble

Drone

Feb 27th, 2020
1,043
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.19 KB | None | 0 0
  1. --[[
  2. Controls
  3. W - forward movement (obviously)
  4. S - backwards movement (obviously)
  5. U - upwards movement
  6. Q - downwards movement
  7. --]]
  8. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  9. local Player,game,owner = owner,game
  10. local RealPlayer = Player
  11. do
  12. print("FE Compatibility code by Mokiros")
  13. local rp = RealPlayer
  14. script.Parent = rp.Character
  15.  
  16. --RemoteEvent for communicating
  17. local Event = Instance.new("RemoteEvent")
  18. Event.Name = "UserInput_Event"
  19.  
  20. --Fake event to make stuff like Mouse.KeyDown work
  21. local function fakeEvent()
  22. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  23. t.connect = t.Connect
  24. return t
  25. end
  26.  
  27. --Creating fake input objects with fake variables
  28. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  29. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  30. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  31. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  32. end}
  33. --Merged 2 functions into one by checking amount of arguments
  34. CAS.UnbindAction = CAS.BindAction
  35.  
  36. --This function will trigger the events that have been :Connect()'ed
  37. local function te(self,ev,...)
  38. local t = m[ev]
  39. if t and t._fakeEvent then
  40. for _,f in pairs(t.Functions) do
  41. f(...)
  42. end
  43. end
  44. end
  45. m.TrigEvent = te
  46. UIS.TrigEvent = te
  47.  
  48. Event.OnServerEvent:Connect(function(plr,io)
  49. if plr~=rp then return end
  50. m.Target = io.Target
  51. m.Hit = io.Hit
  52. if not io.isMouse then
  53. local b = io.UserInputState == Enum.UserInputState.Begin
  54. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  55. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  56. end
  57. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  58. return m:TrigEvent(b and "Button2Down" or "Button2Up")
  59. end
  60. for _,t in pairs(CAS.Actions) do
  61. for _,k in pairs(t.Keys) do
  62. if k==io.KeyCode then
  63. t.Function(t.Name,io.UserInputState,io)
  64. end
  65. end
  66. end
  67. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  68. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  69. end
  70. end)
  71. Event.Parent = NLS([==[
  72. local Player = game:GetService("Players").LocalPlayer
  73. local Event = script:WaitForChild("UserInput_Event")
  74. local Mouse = Player:GetMouse()
  75. local UIS = game:GetService("UserInputService")
  76. local input = function(io,a)
  77. if a then return end
  78. --Since InputObject is a client-side instance, we create and pass table instead
  79. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  80. end
  81. UIS.InputBegan:Connect(input)
  82. UIS.InputEnded:Connect(input)
  83. local h,t
  84. --Give the server mouse data 30 times every second, but only if the values changed
  85. --If player is not moving their mouse, client won't fire events
  86. while wait(1/30) do
  87. if h~=Mouse.Hit or t~=Mouse.Target then
  88. h,t=Mouse.Hit,Mouse.Target
  89. Event:FireServer({isMouse=true,Target=t,Hit=h})
  90. end
  91. end]==],Player.Character)
  92.  
  93. ----Sandboxed game object that allows the usage of client-side methods and services
  94. --Real game object
  95. local _rg = game
  96.  
  97. --Metatable for fake service
  98. local fsmt = {
  99. __index = function(self,k)
  100. local s = rawget(self,"_RealService")
  101. if s then
  102. return typeof(s[k])=="function"
  103. and function(_,...)return s[k](s,...)end or s[k]
  104. end
  105. end,
  106. __newindex = function(self,k,v)
  107. local s = rawget(self,"_RealService")
  108. if s then s[k]=v end
  109. end
  110. }
  111. local function FakeService(t,RealService)
  112. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  113. return setmetatable(t,fsmt)
  114. end
  115.  
  116. --Fake game object
  117. local g = {
  118. GetService = function(self,s)
  119. return rawget(self,s) or _rg:GetService(s)
  120. end,
  121. Players = FakeService({
  122. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  123. },"Players"),
  124. UserInputService = FakeService(UIS,"UserInputService"),
  125. ContextActionService = FakeService(CAS,"ContextActionService"),
  126. RunService = FakeService({
  127. _btrs = {},
  128. RenderStepped = _rg:GetService("RunService").Heartbeat,
  129. BindToRenderStep = function(self,name,_,fun)
  130. self._btrs[name] = self.Heartbeat:Connect(fun)
  131. end,
  132. UnbindFromRenderStep = function(self,name)
  133. self._btrs[name]:Disconnect()
  134. end,
  135. },"RunService")
  136. }
  137. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  138. g.service = g.GetService
  139. FakeService(g,game)
  140. --Changing owner to fake player object to support owner:GetMouse()
  141. game,owner = g,g.Players.LocalPlayer
  142. end
  143. -- by fr34ky;
  144. local char = owner.Character
  145.  
  146. moveforwardenabled = false
  147. moveupenabled = false
  148. movedownenabled = false
  149. movebackwardsenabled = false
  150. local player = owner
  151. repeat wait() until player.Character.Humanoid
  152. local humanoid = player.Character.Humanoid
  153. local mouse = player:GetMouse()
  154.  
  155. local weld = Instance.new("Weld",char.Torso)
  156. weld.Part0 = char.Torso
  157.  
  158. local pf = Instance.new("ForceField")
  159. pf.Parent = game.Players.LocalPlayer.Character
  160.  
  161. for i,v in pairs(char.Torso:GetChildren()) do
  162. if v.ClassName == 'Decal' then
  163. v:Destroy()
  164. end
  165. end
  166. for i,v in pairs(char:GetChildren()) do
  167. if v.ClassName == 'Accessory' then
  168. v:Destroy()
  169. end
  170. end
  171. for i,v in pairs(char.Head:GetChildren()) do
  172. if v.ClassName == 'Decal' then
  173. v:Destroy()
  174. end
  175. end
  176.  
  177. char.Humanoid.JumpPower = 200
  178. char.Humanoid.Jump = true
  179.  
  180. char.Torso.Size = Vector3.new(4.013, 1.066, 3.648)
  181. local plane = Instance.new('SpecialMesh', char.Torso)
  182. plane.MeshType = 'FileMesh'
  183. plane.MeshId = 'rbxassetid://972314388'
  184. plane.TextureId = 'rbxassetid://972315530'
  185. plane.Scale = Vector3.new(1, 1, 1)
  186.  
  187. planesound=Instance.new('Sound', char.Torso)
  188. planesound.SoundId = 'rbxassetid://439771510'
  189. planesound.Volume = 1
  190. planesound.Looped = true
  191.  
  192. pullup=Instance.new('Sound', char.Torso)
  193. pullup.SoundId = 'rbxassetid://144560522'
  194. pullup.Volume = 10
  195. pullup.Looped = true
  196.  
  197. alarm=Instance.new('Sound', char.Torso)
  198. alarm.SoundId = 'rbxassetid://384231761'
  199. alarm.Volume = 10
  200. alarm.Looped = true
  201.  
  202.  
  203. screech=Instance.new('Sound', char.Torso)
  204. screech.SoundId = 'rbxassetid://262353320'
  205. screech.Volume = 10
  206.  
  207. st=Instance.new('Sound', char.Torso)
  208. st.SoundId = 'rbxassetid://131353021'
  209. st.Volume = 20
  210.  
  211. allahuakbar=Instance.new('Sound', char)
  212. allahuakbar.SoundId = 'rbxassetid://293292782'
  213. allahuakbar.Volume = 10
  214.  
  215. moosic=Instance.new('Sound', char)
  216. moosic.SoundId = 'rbxassetid://504630746'
  217. moosic.Volume = 2
  218.  
  219. allahuakbar2=Instance.new('Sound', char)
  220. allahuakbar2.SoundId = 'rbxassetid://446824013' --446824013
  221. allahuakbar2.Volume = 1
  222.  
  223. explosionf=Instance.new('ParticleEmitter', char.Torso)
  224. explosionf.Texture = 'http://www.roblox.com/asset/?id=244514357'
  225. explosionf.Size = NumberSequence.new(19)
  226. explosionf.Rate = 1000
  227. explosionf.LightEmission = 0.4
  228. explosionf.Lifetime = NumberRange.new(1)
  229. explosionf.VelocitySpread = 360
  230. explosionf.Enabled = false
  231.  
  232.  
  233.  
  234. char.Head.Transparency = 1
  235. char['Left Arm'].Transparency = 1
  236. char['Right Arm'].Transparency = 1
  237. char['Left Leg'].Transparency = 1
  238. char['Right Leg'].Transparency = 1
  239.  
  240. 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
  241. local Me = game:GetService("Players").LocalPlayer
  242. local Char = Me.Character
  243. local Mouse = Me:GetMouse()
  244. local Cam = Workspace.CurrentCamera
  245. local Stop = false
  246. local Version = 0
  247. local MaxSpeed = 8
  248. local Speed = 8
  249. local Keys = {}
  250. local Force = 10000 -- 10000 = Fly, 1000000 = Noclip
  251.  
  252. game:GetService("RunService").RenderStepped:connect(function()
  253. if humanoid.Health > 0 then
  254. if moveforwardenabled == true then
  255. char.Torso.CFrame= Char.Torso.CFrame * CFrame.new(0,0,-.50)
  256. end
  257. if movebackwardsenabled == true then
  258. char.Torso.CFrame= Char.Torso.CFrame * CFrame.new(0,0,.50)
  259. end
  260. if moveupenabled == true then
  261. char.Torso.CFrame= Char.Torso.CFrame * CFrame.new(0,.50,0)
  262. end
  263. if movedownenabled == true then
  264. char.Torso.CFrame= Char.Torso.CFrame * CFrame.new(0,-.50,0)
  265. end
  266. char.Torso.CFrame = CFrame.new(char.Torso.Position, Vector3.new(mouse.Hit.p.X, char.Torso.Position.Y, mouse.Hit.p.Z))
  267. end
  268. end)
  269.  
  270. char.Torso.Anchored = true
  271.  
  272. mouse.KeyDown:connect(function(key)
  273. if key == "w" then
  274. moveforwardenabled = true
  275. end
  276. end)
  277. mouse.KeyUp:connect(function(key)
  278. if key == "w" then
  279. moveforwardenabled = false
  280. end
  281. end)
  282. mouse.KeyDown:connect(function(key)
  283. if key == "s" then
  284. movebackwardsenabled = true
  285. end
  286. end)
  287. mouse.KeyUp:connect(function(key)
  288. if key == "s" then
  289. movebackwardsenabled = false
  290. end
  291. end)
  292. mouse.KeyDown:connect(function(key)
  293. if key == "u" then
  294. moveupenabled = true
  295. end
  296. end)
  297. mouse.KeyUp:connect(function(key)
  298. if key == "u" then
  299. moveupenabled = false
  300. end
  301. end)
  302. mouse.KeyDown:connect(function(key)
  303. if key == "q" then
  304. movedownenabled = true
  305. end
  306. end)
  307. mouse.KeyUp:connect(function(key)
  308. if key == "q" then
  309. movedownenabled = false
  310. end
  311. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement