Advertisement
daaa

Untitled

Jun 19th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.39 KB | None | 0 0
  1. --Made by Stickmasterluke
  2.  
  3.  
  4. sp=script.Parent
  5.  
  6.  
  7. speed=4.2
  8. topspeed=45 -- I had to.
  9.  
  10.  
  11. rapidfiredamage=0 --Safety purposes.
  12.  
  13. range=350
  14. rate=1/30
  15. barreloffset=Vector3.new(-.05,.5,-1.5)
  16. windvec=Vector3.new(2,-1,1).unit
  17.  
  18. chargemode=1
  19. rapidfiremode=2
  20.  
  21.  
  22. inertia=1-(speed/topspeed)
  23. debris=game:GetService("Debris")
  24. equipped=false
  25. flying=false
  26. check=true
  27. charge=0
  28. controls={forward=0,backward=0,left=0,right=0}
  29. momentum=Vector3.new(0,0,0)
  30. lastmomentum=Vector3.new(0,0,0)
  31. totalmomentum=0
  32. lastflap=0
  33. tilt=0
  34. lasttilt=0
  35. mode=1
  36.  
  37. local wing=Instance.new("Part")
  38. wing.CanCollide=false
  39. wing.BrickColor=BrickColor.new("Really black")
  40. wing.Shape="Block"
  41. wing.FormFactor="Custom"
  42. wing.TopSurface="Smooth"
  43. wing.BottomSurface="Smooth"
  44. wing.Size=Vector3.new(4,4,.6)
  45.  
  46. local WingMesh=Instance.new("SpecialMesh")
  47. WingMesh.TextureId="http://www.roblox.com/asset/?id=131768809" --Wing Texture here!
  48. WingMesh.Scale=Vector3.new(1,1,1)
  49. WingMesh.Parent=wing
  50.  
  51. function waitfor(parent,name)
  52. while parent:FindFirstChild(name)==nil do
  53. wait()
  54. end
  55. return parent:FindFirstChild(name)
  56. end
  57.  
  58. local storeWeld=waitfor(sp,"Motor")
  59. local playsound=waitfor(sp,"PlaySound")
  60. local soundname=waitfor(playsound,"SoundName")
  61. local anim=waitfor(sp,"FlyAnimation")
  62. local gui=waitfor(sp,"ArtemisGui")
  63. local ButtonHolder=waitfor(gui,"ButtonHolder")
  64. local button1=waitfor(ButtonHolder,"Button1")
  65. local button2=waitfor(ButtonHolder,"Button2")
  66.  
  67. function checkintangible(hit)
  68. if hit and hit~=nil then
  69. if hit:IsDescendantOf(sp.Parent) or hit.Transparency>.8 or hit.Name=="Handle" or string.lower(string.sub(hit.Name,1,6))=="effect" or hit.Name=="Bullet" or hit.Name=="Laser" or string.lower(hit.Name)=="water" or hit.Name=="Rail" or hit.Name=="Arrow" then
  70. return true
  71. end
  72. end
  73. return false
  74. end
  75.  
  76. function changemode(newmode) -- for lines 76-86, all I did was uncheck Visible for ArtemisGUI.
  77. charge=0
  78. mode=newmode
  79. button1.Image="http://www.roblox.com/asset/?id=32935220"
  80. button2.Image="http://www.roblox.com/asset/?id=32935220"
  81. if mode==1 then
  82. button1.Image="http://www.roblox.com/asset/?id=32935220"
  83. elseif mode==2 then
  84. button2.Image="http://www.roblox.com/asset/?id=32935220"
  85. end
  86. end
  87.  
  88. function castray(startpos,vec,length,ignore,delayifhit)
  89. local hit,endpos2=game.Workspace:FindPartOnRay(Ray.new(startpos,vec*length),ignore)
  90. if hit~=nil then
  91. if checkintangible(hit) then
  92. if delayifhit then
  93. wait()
  94. end
  95. hit,endpos2=castray(endpos2+(vec*.01),vec,length-((startpos-endpos2).magnitude),ignore,delayifhit)
  96. end
  97. end
  98. return hit,endpos2
  99. end
  100.  
  101. function drawbeam(beamstart,beamend,clr,fadedelay)
  102. local dist=(beamstart-beamend).magnitude
  103. local laser=Instance.new("Part")
  104. laser.Name="Effect"
  105. laser.Anchored=true
  106. laser.CanCollide=false
  107. laser.Shape="Block"
  108. laser.formFactor="Custom"
  109. laser.Size=Vector3.new(.2,.2,.2)
  110. laser.Transparency=5
  111. laser.Material=Enum.Material.Plastic
  112. laser.Locked=true
  113. laser.TopSurface=0
  114. laser.BottomSurface=0
  115. laser.BrickColor=clr
  116. laser.CFrame=CFrame.new(beamend,beamstart)*CFrame.new(0,0,-dist/2)*CFrame.Angles(math.pi/2,0,0)
  117. local m=Instance.new("SpecialMesh")
  118. m.Scale=Vector3.new(1,dist*5,1)
  119. m.Parent=laser
  120. debris:AddItem(laser,fadedelay*3)
  121. laser.Parent=game.Workspace
  122.  
  123. local frames=math.floor(fadedelay/rate)
  124. for frame=1,frames do
  125. wait(rate)
  126. local percent=frame/frames
  127. laser.CFrame=laser.CFrame+windvec*rate
  128. laser.Transparency=1+(percent*1)
  129. end
  130. wait(1)
  131. laser:remove()
  132. end
  133.  
  134. function fire(targetpos,startpos,damage,fadedelay)
  135. local fakestartpos=(sp.Handle.CFrame*CFrame.new(barreloffset)).p
  136. local vec=(targetpos-startpos).unit
  137.  
  138. local p=Instance.new("Part")
  139. p.Name="Arrow"
  140. p.BrickColor=BrickColor.new("Black")
  141. p.CanCollide=true
  142. p.Transparency=1
  143. p.TopSurface="Smooth"
  144. p.BottomSurface="Smooth"
  145. p.formFactor="Custom"
  146. p.Size=Vector3.new(.3,.3,2.7)
  147. local m=Instance.new("SpecialMesh")
  148. m.MeshId="http://www.roblox.com/asset/?id=92189547"--111826804 <--actual arrow mesh, decided to use Artemis arrow. Looks better imo
  149. m.TextureId="http://www.roblox.com/asset/?id=130336234"
  150. m.Scale=Vector3.new(1,1,1.9)
  151. m.VertexColor=Vector3.new(.1,.1,.2)
  152. m.Parent=p
  153.  
  154. local c=Instance.new("ObjectValue")
  155. c.Name="creator"
  156. c.Value=game.Players.LocalPlayer
  157. c.Parent=p
  158.  
  159. local sound=Instance.new("Sound")
  160. sound.SoundId="http://www.roblox.com/asset/?id=32935220" --SoundID here if you want.
  161. sound.Volume=1
  162. sound.Parent=p
  163. sound:Play()
  164.  
  165. local damagetag=Instance.new("IntValue")
  166. damagetag.Name="DamageTag"
  167. damagetag.Value=damage
  168. damagetag.Parent=p
  169.  
  170. local s=script.Script:clone()
  171. s.Parent=p
  172. s.Disabled=false
  173.  
  174. local hit,endpos=castray(startpos,vec,range,sp.Parent,false)
  175. local fakevec=(endpos-fakestartpos).unit
  176. if hit~=nil then
  177. local newcf=CFrame.new(endpos,endpos+fakevec)*CFrame.new(0,0,.9+(math.random(0,1)*.4))
  178. p.CFrame=newcf
  179. local w=Instance.new("Weld")
  180. w.Part0=hit
  181. w.Part1=p
  182. w.C0=hit.CFrame:inverse()*newcf
  183. w.C1=newcf:inverse()*newcf
  184. w.Parent=p
  185. else
  186. p.CFrame=CFrame.new(endpos,endpos+fakevec)
  187. p.Velocity=fakevec*300
  188. p.Parent=game.Workspace
  189. end
  190.  
  191. debris:AddItem(p,10+(math.random()*10))
  192. p.Parent=game.Workspace
  193.  
  194. delay(0,function()
  195. drawbeam(fakestartpos,endpos,BrickColor.new("Institutional white"),fadedelay)
  196. end)
  197.  
  198. soundname.Value="FireSound"
  199. playsound.Value=not playsound.Value
  200.  
  201. if sp:FindFirstChild("Handle2") then
  202. sp.Handle2.Transparency=1
  203. end
  204. end
  205.  
  206. function RemoveFlyStuff()
  207. local plr=game.Players.LocalPlayer
  208. if plr then
  209. local chr=plr.Character
  210. if chr then
  211. for i,v in ipairs(chr:getChildren()) do
  212. if v and v.Name=="RightWing" or v.Name=="LeftWing" then
  213. v:remove()
  214. end
  215. end
  216. local torso=chr:FindFirstChild("Torso")
  217. if torso~=nil then
  218. for i,v in ipairs(torso:GetChildren()) do
  219. if v and (v.Name=="FlightGyro" or v.Name=="FlightVelocity") then
  220. v:remove()
  221. end
  222. end
  223. end
  224. end
  225. end
  226. end
  227.  
  228. function fly() --(de)activate fly mode
  229. if not equipped then
  230. flying=false
  231. else
  232. flying=not flying
  233. end
  234. RemoveFlyStuff()
  235. if flying then
  236. local torso=sp.Parent:FindFirstChild("Torso")
  237. local humanoid=sp.Parent:FindFirstChild("Humanoid")
  238. if torso and humanoid and humanoid.Health>0 then
  239. momentum=torso.Velocity+(torso.CFrame.lookVector*3)+Vector3.new(0,10,0)
  240.  
  241. local gyro=Instance.new("BodyGyro")
  242. gyro.Name="FlightGyro"
  243. gyro.P=10^6
  244. gyro.maxTorque=Vector3.new(gyro.P,gyro.P,gyro.P)
  245. gyro.cframe=torso.CFrame
  246. gyro.Parent=torso
  247.  
  248. velocity=Instance.new("BodyVelocity")
  249. velocity.Name="FlightVelocity"
  250. velocity.velocity=Vector3.new(0,0,0)
  251. velocity.P=10^4
  252. velocity.maxForce=Vector3.new(1,1,1)*(10^6)
  253. velocity.Parent=torso
  254.  
  255. LeftWing=wing:Clone() --line 255 + 272 = Wing Meshes.
  256. LeftWing.Name="LeftWing"
  257. LeftWing.Mesh.MeshId="http://www.roblox.com/asset/?id=92135524"
  258.  
  259. LeftWeld=Instance.new("Motor")
  260. LeftWeld.Name="LeftWeld"
  261. LeftWeld.Part0=torso
  262. LeftWeld.Part1=LeftWing
  263. LeftWeld.MaxVelocity=.2
  264. LeftWeld.C0=CFrame.new(-.25,1,.25)*CFrame.Angles(math.pi/2,0,0)
  265. LeftWeld.C1=CFrame.new(2,-1,-.25)*CFrame.Angles(math.pi/2,0,0)
  266. LeftWeld.Parent=LeftWing
  267.  
  268. LeftWing.Parent=sp.Parent
  269.  
  270. RightWing=wing:Clone()
  271. RightWing.Name="RightWing"
  272. RightWing.Mesh.MeshId="http://www.roblox.com/asset/?id=92135508"--111892882"
  273.  
  274. RightWeld=Instance.new("Motor")
  275. RightWeld.Name="RightWeld"
  276. RightWeld.Part0=torso
  277. RightWeld.Part1=RightWing
  278. RightWeld.MaxVelocity=.2
  279. RightWeld.C0=CFrame.new(.25,1,.25)*CFrame.Angles(math.pi/2,0,0)
  280. RightWeld.C1=CFrame.new(-2,-1,-.25)*CFrame.Angles(math.pi/2,0,0)
  281. RightWeld.Parent=RightWing
  282.  
  283. RightWing.Parent=sp.Parent
  284.  
  285. if flyanim~=nil then
  286. flyanim:Stop()
  287. end
  288. flyanim=humanoid:LoadAnimation(anim)
  289. if flyanim then
  290. flyanim:Play()
  291. end
  292.  
  293. while flying and torso and humanoid and humanoid.Health>0 and equipped do
  294. local movement=game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(Vector3.new(controls.left+controls.right,math.abs(controls.forward)*.2,controls.forward+controls.backward))*speed
  295.  
  296. momentum=(momentum*inertia)+movement
  297. totalmomentum=momentum.magnitude
  298. if totalmomentum>topspeed then
  299. totalmomentum=topspeed
  300. end
  301.  
  302. local tilt=((momentum*Vector3.new(1,0,1)).unit:Cross(((lastmomentum*Vector3.new(1,0,1)).unit))).y
  303. if tostring(tilt)=="-1.#IND" or tostring(tilt)=="1.#IND" or tilt==math.huge or tilt==-math.huge then
  304. tilt=0
  305. end
  306. local abstilt=math.abs(tilt)
  307. if abstilt>.06 or abstilt<.0001 then
  308. if math.abs(lasttilt)>.0001 then
  309. tilt=lasttilt*.9
  310. else
  311. tilt=0
  312. end
  313. else
  314. tilt=(lasttilt*.77)+(tilt*.25) --weighted average
  315. end
  316. lasttilt=tilt
  317.  
  318. if totalmomentum<.5 then
  319. momentum=Vector3.new(0,0,0)
  320. totalmomentum=0
  321. gyro.cframe=game.Workspace.CurrentCamera.CoordinateFrame
  322. else
  323. gyro.cframe=CFrame.new(Vector3.new(0,0,0),momentum)*CFrame.Angles(0,0,tilt*(-20))*CFrame.Angles(math.pi*(-.5)*(totalmomentum/topspeed),0,0)
  324. end
  325. velocity.velocity=momentum
  326.  
  327. local gravitydelta=(((momentum*Vector3.new(0,1,0))-Vector3.new(0,-topspeed,0)).magnitude/topspeed)*.5
  328. if gravitydelta>.45 and tick()>lastflap then
  329. lastflap=tick()+.5
  330. delay(0,function()
  331. soundname.Value="WingSound"
  332. playsound.Value=not playsound.Value
  333. LeftWeld.DesiredAngle=-1
  334. RightWeld.DesiredAngle=1
  335. wait(.25)
  336. LeftWeld.DesiredAngle=0
  337. RightWeld.DesiredAngle=0
  338. wait(.25)
  339. LeftWeld.DesiredAngle=-.5
  340. RightWeld.DesiredAngle=.5
  341. end)
  342. end
  343. lastmomentum=momentum
  344. wait(rate)
  345. end
  346. RemoveFlyStuff()
  347. if flyanim~=nil then
  348. flyanim:Stop()
  349. end
  350. flying=false
  351. end
  352. end
  353. end
  354.  
  355. function onEquipped(mouse)
  356. equipped=true
  357. if mouse~=nil then
  358. mouse.Icon="rbxasset://textures\\GunCursor.png"
  359. mouse.Button1Down:connect(function()
  360. if not down then
  361. down=true
  362. while down and equipped do
  363. local waited=false
  364. if check then
  365. if mode==rapidfiremode then
  366. local hu=sp.Parent:FindFirstChild("Humanoid")
  367. local he=sp.Parent:FindFirstChild("Head")
  368. local t=sp.Parent:FindFirstChild("Torso")
  369. if check and hu and hu.Health>0 and t and he then
  370. check=false
  371. sp.Handle.Mesh.Scale=Vector3.new(1,1,.9)
  372. storeWeld.C0=CFrame.new(-.05,.5,-.25)*CFrame.Angles(0,math.pi/2,0)
  373. wait(.1)
  374. sp.Handle.Mesh.Scale=Vector3.new(1,1,.7)
  375. fire(mouse.Hit.p,he.Position,rapidfiredamage,.25)
  376. wait(.15)
  377. storeWeld.C0=CFrame.new(-.05,.5,-.5)*CFrame.Angles(0,math.pi/2,0)
  378. if sp:FindFirstChild("Handle2") then
  379. sp.Handle2.Transparency=0
  380. end
  381. wait(.15)
  382. waited=true
  383. check=true
  384. else
  385. break
  386. end
  387. elseif mode==chargemode then
  388. if charge<100 then
  389. charge=charge+1
  390. local percent=(charge/100)
  391. sp.Handle.Mesh.Scale=Vector3.new(1,1,.7+(percent*.6))
  392. storeWeld.C0=CFrame.new(-.05,.5,-.5+(percent*.5))*CFrame.Angles(0,math.pi/2,0)
  393. wait(.05)
  394. waited=true
  395. end
  396. end
  397. end
  398. if not waited then
  399. wait()
  400. end
  401. end
  402. end
  403. end)
  404. mouse.Button1Up:connect(function()
  405. down=false
  406. if mode==chargemode then
  407. local hu=sp.Parent:FindFirstChild("Humanoid")
  408. local he=sp.Parent:FindFirstChild("Head")
  409. local t=sp.Parent:FindFirstChild("Torso")
  410. if check and hu and hu.Health>0 and t and he then
  411. check=false
  412. fire(mouse.Hit.p,he.Position,charge+10,.25+(charge/50))
  413. charge=0
  414. sp.Handle.Mesh.Scale=Vector3.new(1,1,.7)
  415. storeWeld.C0=CFrame.new(-.05,.5,-.5)*CFrame.Angles(0,math.pi/2,0)
  416. wait(.75)
  417. if sp:FindFirstChild("Handle2") then
  418. sp.Handle2.Transparency=0
  419. end
  420. wait(.25)
  421. check=true
  422. end
  423. end
  424. end)
  425. mouse.KeyDown:connect(function(key2)
  426. local key=string.byte(key2)
  427. if key==string.byte("q") then
  428. changemode(1)
  429. elseif key==string.byte("e") then
  430. changemode(2)
  431. elseif key==32 then --Space bar
  432. fly()
  433. local torso=sp.Parent:FindFirstChild("Torso")
  434. if torso~=nil then
  435. torso.Velocity=momentum
  436. end
  437. elseif key==string.byte("w") or key==17 then
  438. controls.forward=-1
  439. elseif key==string.byte("a") or key==20 then
  440. controls.left=-1
  441. elseif key==string.byte("s") or key==18 then
  442. controls.backward=1
  443. elseif key==string.byte("d") or key==19 then
  444. controls.right=1
  445. end
  446. end)
  447. mouse.KeyUp:connect(function(key2)
  448. local key=string.byte(key2)
  449. if key==string.byte("w") or key==17 then
  450. controls.forward=0
  451. elseif key==string.byte("a") or key==20 then
  452. controls.left=0
  453. elseif key==string.byte("s") or key==18 then
  454. controls.backward=0
  455. elseif key==string.byte("d") or key==19 then
  456. controls.right=0
  457. end
  458. end)
  459. local plr=game.Players.LocalPlayer
  460. if plr then
  461. local plrgui=plr:FindFirstChild("PlayerGui")
  462. if plrgui then
  463. gui.Parent=plrgui
  464. end
  465. end
  466. end
  467. if storeWeld then
  468. storeWeld.Parent=sp
  469. end
  470. end
  471.  
  472. function onUnequipped()
  473. equipped=false
  474. storeWeld.C0=CFrame.new(-.05,.5,-.5)*CFrame.Angles(0,math.pi/2,0)
  475. gui.Parent=sp
  476. end
  477.  
  478. sp.Equipped:connect(onEquipped)
  479. sp.Unequipped:connect(onUnequipped)
  480.  
  481. button1.MouseButton1Down:connect(function()
  482. changemode(1)
  483. end)
  484. button2.MouseButton1Down:connect(function()
  485. changemode(2)
  486. end)
  487. changemode(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement