Tjkillzyou27

Roblox:Script Plane testing

Dec 4th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.53 KB | None | 0 0
  1. ----(Sky's Settings)----
  2. local Player = game:getService("Players").LocalPlayer
  3. local Players = game.Players
  4. local Character = Player.Character
  5. ----(Variables)----
  6. local player = game.Players.LocalPlayer
  7. local char = player.Character
  8. local mouse = player:GetMouse()
  9. pie = true
  10.  
  11. nums = Game.Players.LocalPlayer.Character.Head
  12.  
  13. if pie ==true then
  14. if script.Parent.className ~= "HopperBin" then
  15. h = Instance.new("HopperBin")
  16. h.Parent = player.Backpack
  17. h.Name = "plane"
  18. script.Parent = h
  19. end
  20.  
  21. sp = script.Parent
  22.  
  23. hold = false
  24. miss = {}
  25. function selected(mouse, key)
  26. mouse.Button1Down:connect(function()
  27. if hold == true then return end
  28. hold = true
  29. plane = Instance.new("Part",Game.Workspace)
  30. plane.Parent = Game.Workspace
  31. plane.formFactor = 0
  32. plane.Size = Vector3.new(1,1,5)
  33. plane.Anchored = true
  34. plane.CFrame = CFrame.new(Player.Character.Torso.Position, mouse.Hit.p) * CFrame.new(0,0,-.8)
  35.  
  36. bill2 = Instance.new("BillboardGui", plane)
  37. bill2.Size = UDim2.new(4, 4, 4, 4)
  38. bill2.AlwaysOnTop = false
  39. label2 = Instance.new("TextLabel", bill2)
  40. label2.Size = UDim2.new(1,2,1,2)
  41. label2.Position = UDim2.new(0, 0, -.65, 0)
  42. label2.TextColor3 = Color3.new(0, 0, 0)
  43. label2.TextStrokeTransparency = 0
  44. label2.TextStrokeColor3 = Color3.new(255, 255, 255)
  45. label2.BackgroundTransparency = 1
  46. label2.Visible = true
  47. label2.Font = 'SourceSansBold'
  48. label2.FontSize = 'Size36'
  49. label2.Text = "Plane(Scout)"
  50. Player.Chatted:connect(function(msg)
  51. label2.Text = msg
  52. end)
  53.  
  54. mesh = Instance.new("FileMesh", plane)
  55. mesh.MeshId = "http://www.roblox.com/asset?id=113216991"
  56. mesh.TextureId = "http://www.roblox.com/asset?id=113216977"
  57. mesh.Scale = Vector3.new(4,4,4)
  58. workspace.CurrentCamera.CameraSubject = plane
  59. table.insert(miss,plane)
  60. while hold == true do
  61. wait()
  62. plane.CFrame = CFrame.new(plane.Position, mouse.Hit.p)
  63. plane.CFrame = plane.CFrame * CFrame.new(0,0,-.8)
  64. end
  65. end)
  66. mouse.Button1Up:connect(function()
  67. end)
  68. end
  69.  
  70. sp.Selected:connect(selected)
  71.  
  72. end
  73.  
  74.  
  75. --[[local vehseat = Instance.new('VehicleSeat',plane)
  76. coroutine.resume(coroutine.create(function()
  77. while wait() do
  78. vehseat.CFrame = Workspace.plane.CFrame
  79. vehseat.Anchored = true
  80. end
  81. end))]]
  82.  
  83.  
  84.  
  85. mouse.KeyDown:connect(function(key)
  86. key = key:lower()
  87. if key == "f" then
  88. local ray = Ray.new(plane.CFrame.p, (mouse.Hit.p - plane.CFrame.p).unit * 300)
  89. local part, position = workspace:FindPartOnRay(ray,char, false, true)
  90. local beam = Instance.new("Part", workspace)
  91. beam.BrickColor = BrickColor.new("Bright red")
  92. beam.FormFactor = "Custom"
  93. beam.Material = "Neon"
  94. beam.Transparency = 0
  95. beam.Anchored = true
  96. beam.Locked = true
  97. beam.CanCollide = false
  98.  
  99. local distance = (plane.CFrame.p - position).magnitude
  100. beam.Size = Vector3.new(0.2, 0.2, distance)
  101. beam.CFrame = CFrame.new(plane.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
  102.  
  103. game:GetService("Debris"):AddItem(beam, 0.3)
  104. if part then
  105. local humanoid = part.Parent:FindFirstChild("Humanoid")
  106.  
  107. if not humanoid then
  108. humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
  109. local new_sound = Instance.new('Sound',plane)
  110. new_sound.SoundId = "rbxassetid://180204650"
  111. new_sound.Parent = plane
  112. new_sound.Volume = 1
  113. new_sound:Play()
  114. new_sound:Stop()
  115. end
  116.  
  117. if humanoid then
  118. local new_sound = Instance.new('Sound',plane)
  119. new_sound.SoundId = "rbxassetid://180204650"
  120. new_sound.Parent = plane
  121. new_sound.Volume = 1
  122. new_sound:Play()
  123. new_sound:Stop()
  124. humanoid:TakeDamage(30)
  125. local GrenadeBLOCK = Instance.new('Part',workspace)
  126. GrenadeBLOCK.CFrame = mouse.Hit
  127. GrenadeBLOCK.Transparency = 1
  128. local Grenade = Instance.new('Explosion',workspace)
  129. Grenade.Position = GrenadeBLOCK.Position
  130. Grenade.BlastRadius = 2
  131. GrenadeBLOCK:Remove()
  132.  
  133.  
  134. end
  135. end
  136. wait(0.3)
  137. local ray = Ray.new(plane.CFrame.p, (mouse.Hit.p - plane.CFrame.p).unit * 300)
  138. local part, position = workspace:FindPartOnRay(ray,char, false, true)
  139. local beam = Instance.new("Part", workspace)
  140. beam.BrickColor = BrickColor.new("Bright red")
  141. beam.FormFactor = "Custom"
  142. beam.Material = "Neon"
  143. beam.Transparency = 0
  144. beam.Anchored = true
  145. beam.Locked = true
  146. beam.CanCollide = false
  147.  
  148. local distance = (plane.CFrame.p - position).magnitude
  149. beam.Size = Vector3.new(0.2, 0.2, distance)
  150. beam.CFrame = CFrame.new(plane.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
  151.  
  152. game:GetService("Debris"):AddItem(beam, 0.3)
  153. if part then
  154. local humanoid = part.Parent:FindFirstChild("Humanoid")
  155.  
  156. if not humanoid then
  157. humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
  158. local new_sound = Instance.new('Sound',plane)
  159. new_sound.SoundId = "rbxassetid://180204650"
  160. new_sound.Parent = plane
  161. new_sound.Looped=true
  162. new_sound.Volume = 1
  163. new_sound:Play()
  164. new_sound:Stop()
  165. end
  166.  
  167. if humanoid then
  168. local new_sound = Instance.new('Sound',plane)
  169. new_sound.SoundId = "rbxassetid://180204650"
  170. new_sound.Parent = plane
  171. new_sound.Looped=true
  172. new_sound.Volume = 1
  173. new_sound:Play()
  174. new_sound:Stop()
  175. humanoid:TakeDamage(30)
  176. local GrenadeBLOCK = Instance.new('Part',workspace)
  177. GrenadeBLOCK.CFrame = mouse.Hit
  178. GrenadeBLOCK.Transparency = 1
  179. local Grenade = Instance.new('Explosion',workspace)
  180. Grenade.Position = GrenadeBLOCK.Position
  181. Grenade.BlastRadius = 2
  182. GrenadeBLOCK:Remove()
  183.  
  184.  
  185. end
  186. end
  187.  
  188. end
  189. end)
  190.  
  191.  
  192. mouse.KeyDown:connect(function(key)
  193. key = key:lower()
  194. if key == "r" then
  195. local new_sound = Instance.new('Sound',plane)
  196. new_sound.SoundId = "rbxassetid://152400962"
  197. new_sound:Play()
  198. new_sound.Volume = .4
  199. end
  200. end)
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207. mouse.KeyDown:connect(function(key)
  208. key = key:lower()
  209. if key == "e" then
  210.  
  211. local gui = Instance.new("BillboardGui", nums)
  212. gui.Parent=nums
  213. gui.AlwaysOnTop = true
  214. gui.Adornee=nums
  215. gui.Size=UDim2.new(3,0,3,0)
  216. gui.StudsOffset=Vector3.new(0.4,-.5,0)
  217. text=Instance.new("ImageLabel")
  218. text.Image = "http://www.roblox.com/asset/?id=142406345"
  219. text.Size=UDim2.new(1,0,1,0)
  220. text.Position=UDim2.new(-0.125,0,-0.25,0)
  221. text.BackgroundTransparency = 1
  222. text.Parent=gui
  223.  
  224. game:GetService('Players').PlayerAdded:connect(function(player)
  225. player.CharacterAdded:connect(function(character)
  226. character:WaitForChild("Humanoid").Died:connect(function()
  227. pcall(function() game:service("StarterGui"):SetCore("ChatMakeSystemMessage",{Text="[Plane] Target: Destoyed"}) end)
  228. end)
  229. end)
  230. end)
  231. end
  232. end)
  233.  
  234. game:GetService('Players').PlayerAdded:connect(function(player)
  235. player.CharacterAdded:connect(function(character)
  236. character:WaitForChild("Humanoid").Died:connect(function()
  237. pcall(function() game:service("StarterGui"):SetCore("ChatMakeSystemMessage",{Text="[Plane] Target: Destoyed"}) end)
  238. end)
  239. end)
  240. end)
  241.  
  242. mouse.KeyDown:connect(function(key)
  243. key = key:lower()
  244. if key == "l" then
  245. hold = false
  246. workspace.CurrentCamera.CameraSubject = char.Humanoid
  247. plane:Destroy()
  248. end
  249. end)
  250.  
  251. mouse.KeyDown:connect(function(key)
  252. key = key:lower()
  253. if key == "w" then
  254. function Loop1()
  255. while true and wait() do
  256. plane.CFrame = plane.CFrame * CFrame.new(0,0,-.8)
  257. end
  258. end
  259. my_first_coroutine = coroutine.create(Loop1)
  260. coroutine.resume(my_first_coroutine)
  261.  
  262. function Loop2()
  263. while true and wait() do
  264. plane.CFrame = plane.CFrame * CFrame.new(0,0,-.8)
  265. end
  266. end
  267. end
  268. end)
  269.  
  270.  
  271.  
  272. mouse.KeyDown:connect(function(key)
  273. key = key:lower()
  274. if key == "s" then
  275. function Loop1()
  276. while true and wait() do
  277. plane.CFrame = plane.CFrame * CFrame.new(0,0,.4)
  278. end
  279. end
  280. my_first_coroutine = coroutine.create(Loop1)
  281. coroutine.resume(my_first_coroutine)
  282.  
  283. function Loop2()
  284. while true and wait() do
  285. plane.CFrame = plane.CFrame * CFrame.new(0,0,.4)
  286. end
  287. end
  288. end
  289. end)
  290.  
  291.  
  292. --Partical gun
  293.  
  294. local new=Instance.new
  295. local rad=math.rad
  296. local cf=CFrame.new
  297. local v3=Vector3.new
  298. local ang=function(x,y,z)
  299. return CFrame.Angles(rad(x),rad(y),rad(z))
  300. end
  301. local player=game:service'Players'.LocalPlayer
  302. local char=player.Character
  303. local cam=workspace.Camera
  304. local mouse=player:GetMouse()
  305. local weld=function(a,b,c0,c1)
  306. m=Instance.new('Motor',a)
  307. m.Part0=a
  308. m.Part1=b
  309. m.C0=c0
  310. m.C1=c1
  311. return m
  312. end
  313.  
  314. snd='rbxassetid://--247600043'
  315. beamm=Instance.new('Model',workspace)
  316. beamm.Name='beam'
  317.  
  318. laser=false
  319.  
  320. rs=Instance.new('Part',char)
  321. rs.Transparency=1
  322. rs.CanCollide=false
  323. rs.TopSurface,rs.BottomSurface=0,0
  324. rs.FormFactor=3
  325. rs.Size=Vector3.new(.5,.5,.5)
  326.  
  327. ls=rs:Clone()
  328. ls.Parent=char
  329.  
  330. rsw=weld(rs,char.Torso,cf(-1,-.5,0),cf())
  331. lsw=weld(ls,char.Torso,cf(1,-.5,0),cf())
  332. raw=weld(char['Right Arm'],rs,cf(-.5,.6,-.14),ang(90,0,-8))
  333. law=weld(char['Left Arm'],ls,cf(-.3,1.5,-.14),ang(90,0,43))
  334.  
  335. s1=Instance.new('Sound',char)
  336. s1.Volume=1
  337. s1.Pitch=1.2
  338. s1.Looped=true
  339. s1.SoundId=snd
  340.  
  341. particles={}
  342.  
  343. local wep=new('Part',char)
  344. wep.FormFactor=3
  345. wep.CanCollide=false
  346. wep.Size=v3(1,3,1)
  347. wep.TopSurface,wep.BottomSurface=0,0
  348. wep.Transparency=1
  349. local wepw=weld(wep,char['Right Arm'],cf(.26,.4,.7),ang(0,0,8))
  350.  
  351. local beam=wep:Clone()
  352. beam:ClearAllChildren()
  353. beam.Material='Neon'
  354. beam.BrickColor=BrickColor.new('Really red')
  355. beam.Size=Vector3.new(3,3,1)
  356. beam.Transparency=.5
  357. beam.Anchored=true
  358. local ms=Instance.new('BlockMesh',beam)
  359. local inner=beam:Clone()
  360. inner.Transparency=0
  361. inner.Material='SmoothPlastic'
  362. inner.BrickColor=BrickColor.new('Really black')
  363. local ms2=inner.Mesh
  364.  
  365. local expl=inner:Clone()
  366. expl.Mesh:Destroy()
  367. expl.Material='Neon'
  368. expl.BrickColor=BrickColor.new('Really red')
  369. expl.Size=Vector3.new(11,11,11)
  370. expl.Transparency=.55
  371. pl=Instance.new('PointLight',expl)
  372. pl.Color=expl.BrickColor.Color
  373. pl.Range=pl.Range*2
  374. pl.Name='light'
  375. local br=pl.Range
  376.  
  377. local exa=expl:Clone()
  378. exa.Size=Vector3.new(.4,.4,.4)
  379. pl2=exa.light
  380.  
  381. local part=exa:Clone()
  382. part.Size=Vector3.new(1.5,1.5,1.5)
  383. pl3=part.light
  384. pms=Instance.new('BlockMesh',part)
  385.  
  386. char.Humanoid.Died:connect(function()
  387. laser=false
  388. beam.Parent=nil
  389. inner.Parent=nil
  390. expl.Parent=nil
  391. exa.Parent=nil
  392. s1:stop()
  393. end)
  394.  
  395. mouse.KeyDown:connect(function(key)
  396. key = key:lower()
  397. if key == "g" then
  398. laser=true
  399. s1.Volume=1
  400. s1:play()
  401. end end)
  402. mouse.KeyDown:connect(function(key)
  403. key = key:lower()
  404. if key == "k" then
  405. laser=false
  406. beam.Parent=nil
  407. inner.Parent=nil
  408. expl.Parent=nil
  409. exa.Parent=nil
  410. s1:stop()
  411. end end)
  412.  
  413. parti=0
  414. game:service'RunService'.Stepped:connect(function()
  415. parti=parti+1
  416. for i,v in pairs(particles) do
  417. v.CFrame=v.CFrame*CFrame.new(0,0,-.1)
  418. v.Transparency=1
  419. v.BrickColor=BrickColor.new(Color3.new(math.random(),math.random(),math.random()))
  420. if v.Transparency >= 1 then
  421. v:Destroy()
  422. table.remove(particles,i)
  423. else
  424. v.Parent=beamm
  425. end
  426. end
  427. a=cam.CoordinateFrame.p
  428. b=mouse.Hit.p
  429. mhitr=Ray.new(a,(b-a).unit*999)
  430. mhit,ps=workspace:FindPartOnRayWithIgnoreList(mhitr,{char,beamm})
  431. raw.C1=ang(90+(mouse.Hit.lookVector.y*90),0,-8)
  432.  
  433. if not char.Humanoid.Sit and not char.Humanoid.PlatformStand then
  434. char.Torso.CFrame=CFrame.new(char.Torso.CFrame.p,Vector3.new(ps.x,char.Torso.CFrame.p.y,ps.z))
  435. end
  436. if laser then
  437. beamm.Parent=workspace
  438. beam.Parent=beamm
  439. inner.Parent=beamm
  440. expl.Parent=beamm
  441. exa.Parent=beamm
  442.  
  443. ray=Ray.new((plane.CFrame*cf(0,-1.5,0)).p,((plane.CFrame*cf(0,-10,0)).p-(plane.CFrame*cf(0,-1.5,0)).p).unit*999)
  444. hit,pos=workspace:FindPartOnRayWithIgnoreList(ray,{char,beamm})
  445.  
  446. if hit and hit.Parent:findFirstChild('Humanoid') and s1.Volume > .3 and parti/8==math.floor(parti/8) then
  447. Instance.new('Explosion',workspace).Position=pos
  448. end
  449. if hit and hit.Parent==workspace.Terrain or hit==workspace.Terrain and parti/8==math.floor(parti/8) then
  450. e=Instance.new('Explosion',workspace)
  451. e.Position=pos
  452. e.BlastRadius=14
  453. e.BlastPressure=1e4
  454. end
  455. if hit and not hit.Anchored and not (hit:GetMass()>1e4) then
  456. hit.Velocity=hit.Velocity+beam.CFrame.lookVector*(1*s1.Volume*hit:GetMass())
  457. end
  458.  
  459. if parti==math.floor(parti) then
  460. par=part:Clone()
  461. table.insert(particles,par)
  462. par.Parent=beamm
  463. par.Transparency=11111
  464. par.CFrame=cf(pos)*ang(math.random(-180,180),math.random(-180,180),math.random(-180,180))*cf(0,0,-10)
  465. end
  466.  
  467. mag=((plane.CFrame*cf(0,-1.5,0)).p-pos).magnitude
  468. ms.Scale=v3(s1.Volume,s1.Volume,mag)
  469. ms2.Scale=v3(ms.Scale.x/2,ms.Scale.y/2,mag-(.1/mag))
  470. beam.CFrame=cf((plane.CFrame*cf(0,-1.5,0)).p,pos)*cf(0,0,-mag/2)*ang(0,0,math.random(0,180))
  471. inner.CFrame=beam.CFrame
  472. expl.Size=v3(math.random(9,13),math.random(9,13),math.random(9,13))*s1.Volume
  473. expl.Transparency=.2
  474. expl.CFrame=cf(pos)*ang(math.random(0,180),math.random(0,180),math.random(0,180))
  475. exa.Size=v3(.4,.4,.4)*s1.Volume
  476. exa.CFrame=plane.CFrame*cf(0,-1.5,0)*ang(math.random(0,180),math.random(0,180),math.random(0,180))
  477. end
  478. end)
  479.  
  480.  
  481.  
  482.  
  483.  
  484. bill2 = Instance.new("BillboardGui", nums)
  485. bill2.Size = UDim2.new(4, 4, 4, 4)
  486. bill2.AlwaysOnTop = false
  487. label = Instance.new("TextLabel", bill2)
  488. label.Size = UDim2.new(1,2,1,2)
  489. label.Position = UDim2.new(0, 0, -.65, 0)
  490. label.TextColor3 = Color3.new(255, 0, 255)
  491. label.TextStrokeTransparency = 0
  492. label.TextStrokeColor3 = Color3.new(255, 255, 255)
  493. label.BackgroundTransparency = 1
  494. label.Visible = true
  495. label.Font = 'SourceSansBold'
  496. label.FontSize = 'Size36'
  497. label.Text = "Target"
Add Comment
Please, Sign In to add comment