awzp

Koopa Plane (not by me)

Jun 3rd, 2018
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.33 KB | None | 0 0
  1. function rand(a)return (math.random()-.5)*2*a end
  2. function q(f,arg)return coroutine.resume(coroutine.create(f),unpack(arg or {}))end
  3. function fade(p,s)q(function(part,start)for i=start,1,.05 do part.Transparency = part.Transparency+0.05 wait(1/30)end end,{p,s})end
  4. function appear(p,s)q(function(part,start)for i=start,0,-.05 do part.Transparency = part.Transparency-0.05 wait(1/30)end end,{p,s})end
  5. function Part(Name,Parent,Size,CFrame,Color,Trans,Anch,Can,Mat,Ref)
  6. local p = Instance.new("Part",Parent)p.Name = Name
  7. p.FormFactor = "Custom"p.Size = Size
  8. p.Anchored = Anch p.CFrame = CFrame
  9. p.BrickColor = BrickColor.new(Color)p.Transparency = Trans
  10. p.TopSurface = 0 p.CanCollide = Can
  11. p.BottomSurface = 0 p.Material = Mat
  12. p.Reflectance = Ref or 0;p:BreakJoints()
  13. p.Locked = true;return p
  14. end
  15. function WedgePart(Name,Parent,Size,CFrame,Color,Trans,Anch,Can,Mat,Ref)
  16. local p = Instance.new("WedgePart",Parent)p.Name = Name
  17. p.FormFactor = "Custom"p.Size = Size
  18. p.Anchored = Anch p.CFrame = CFrame
  19. p.BrickColor = BrickColor.new(Color)p.Transparency = Trans
  20. p.TopSurface = 0 p.CanCollide = Can
  21. p.BottomSurface = 0 p.Material = Mat
  22. p.Reflectance = Ref or 0;p:BreakJoints()
  23. p.Locked = true;return p
  24. end
  25. function CornerWedgePart(Name,Parent,Size,CFrame,Color,Trans,Anch,Can,Mat,Ref)
  26. local p = Instance.new("CornerWedgePart",Parent)p.Name = Name;p.Size = Size
  27. p.Anchored = Anch p.CFrame = CFrame
  28. p.BrickColor = BrickColor.new(Color)p.Transparency = Trans
  29. p.TopSurface = 0 p.CanCollide = Can
  30. p.BottomSurface = 0 p.Material = Mat
  31. p.Reflectance = Ref or 0;p:BreakJoints()
  32. p.Locked = true;return p
  33. end
  34. function Mesh(Parent,Type,Scale,ID,TID)
  35. local m = Instance.new("SpecialMesh",Parent)m.MeshType = Type
  36. m.Scale = Scale or Vector3.new(1,1,1)
  37. if ID then m.MeshId = ID end if TID then m.TextureId = TID end
  38. return m
  39. end
  40. function Weld(p1,p2,c0,c1)
  41. local w = Instance.new("Weld",p1)w.Part0 = p1;w.Part1 = p2
  42. w.C0,w.C1 = c0 or CFrame.new(),c1 or CFrame.new()
  43. return w
  44. end
  45. function cslerp(c1,c2,t)
  46. local function s(a,b,c)return (1-c)*a+(c*b)end
  47. local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}
  48. local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
  49. for i,v in pairs(com1)do com1[i] = s(v,com2[i],t)end
  50. return CFrame.new(com1[1],com1[2],com1[3])*CFrame.Angles(select(4,unpack(com1)))
  51. end
  52. local char
  53. ---------------------------------------------
  54. player = game:service("Players").LocalPlayer
  55. repeat wait() char = player.Character until char
  56. pcall(function()char:FindFirstChild("Animate"):Destroy()end)
  57. root = char:WaitForChild("HumanoidRootPart")
  58. torso = char:WaitForChild("Torso")
  59. humanoid = char:WaitForChild("Humanoid")
  60. mouse = player:GetMouse()
  61. step = game:service("RunService").Stepped
  62. asset = "http://www.roblox.com/asset/?id="
  63. meshes = {["blast"] = 20329976,["ring"] = 3270017,["spike"] = 1033714,["cone"] = 1082802,["crown"] = 20329976,["cloud"] = 1095708,["diamond"] = 9756362}
  64. sounds = {["explode"] = 130792180;}
  65. colour = "White"
  66. scolour = tostring(BrickColor.random())--"Lime green"
  67. Attacking = false
  68. local bv,bp,bg
  69. hover = 10
  70. carspeed = 60
  71. keysdown = {}
  72. c0ls = CFrame.new(-1,0.5,0)*CFrame.Angles(math.pi/6,0,0)
  73. c0rs = CFrame.new(1,0.5,0)*CFrame.Angles(math.pi/6,0,0)
  74. c1ls = CFrame.new(0.5,0.5,0)
  75. c1rs = CFrame.new(-0.5,0.5,0)
  76. c0tw = CFrame.new(0,0,0)
  77. c1tw = CFrame.new(0,0,0)
  78. rs = Weld(torso,char:WaitForChild("Right Arm"),c0rs,c1rs)
  79. ls = Weld(torso,char:WaitForChild("Left Arm"),c0ls,c1ls)
  80. tw = Weld(root,torso,c0tw,c1tw)
  81. ---------------------------------------------
  82. function Smoke(origin,color)
  83. local p = Part("Effect",workspace,Vector3.new(2,2,2),origin*CFrame.new(rand(10),-1,rand(10)),color or "Black",.1,false,false,"SmoothPlastic")
  84. local m = Mesh(p,"Sphere",Vector3.new(1.25,1.25,1.25))
  85. local bp = Instance.new("BodyPosition",p)bp.D = 100 bp.P = 100 bp.position = p.Position+Vector3.new(0,7,0)
  86. q(function(pa,me)
  87. fade(pa,.1)
  88. for i=25,100 do
  89. me.Scale = me.Scale+Vector3.new(0.15,0.1,0.15)
  90. wait(1/30)
  91. end
  92. pa:Destroy()
  93. end,{p,m})
  94. end
  95. function crownExplode(origin,color,size)
  96. local p = Part("Effect",workspace,Vector3.new(size,size,size),origin,color,.2,true,false,"SmoothPlastic")
  97. local m = Mesh(p,"FileMesh",Vector3.new(size/2,size/2,size/2),asset..meshes["crown"])
  98. q(function(pa,me)
  99. for i=.2,1,.025 do
  100. me.Scale = me.Scale+Vector3.new(0.75,0.75,0.75)
  101. pa.Transparency = i
  102. wait(1/30)
  103. end
  104. pa:Destroy()
  105. end,{p,m})
  106. end
  107. function quickSound(id,v)
  108. local s = Instance.new("Sound",workspace)
  109. s.SoundId = id
  110. s.PlayOnRemove = true
  111. s.Volume = v or 1
  112. delay(0.025,function()s:remove()end)
  113. end
  114. function checkDmgArea(origin,dmg,d)
  115. for i,v in pairs(workspace:children())do
  116. if v~=char and v:FindFirstChild("Torso") then
  117. local h;
  118. for _,k in pairs(v:children())do if k:IsA("Humanoid") then h = k end end
  119. local dist = (origin.p - v:FindFirstChild("Torso").CFrame.p).magnitude
  120. if dist < d and h~=nil then
  121. h.Health = h.Health - dmg
  122. end
  123. end
  124. end
  125. end
  126. function Shoot(start,dmg)
  127. dmg = dmg or 15
  128. local vel = start.lookVector
  129. local p = Part("Bullet",workspace,Vector3.new(4,4,4),start,"Black",0,true,false,"SmoothPlastic")
  130. local m = Mesh(p,"Sphere")
  131. local num = 0
  132. local ign = char:children()
  133. local connect
  134. connect = step:connect(function()
  135. num = num + 1
  136. local pp = p.Position
  137. local h,po
  138. vel = vel - Vector3.new(0,math.min(999.5,vel.magnitude/50),0)
  139. repeat
  140. local r = Ray.new(pp,vel.unit*math.min(999.5,vel.magnitude/100+4))
  141. h,po = workspace:FindPartOnRayWithIgnoreList(r,ign)
  142. if h then
  143. if h.CanCollide then break
  144. else table.insert(ign,h)h = nil
  145. end
  146. else break
  147. end
  148. until false
  149. p.CFrame = CFrame.new(po,po+vel)
  150. q(function(b)
  151. local a = b:Clone()
  152. a.Parent = workspace
  153. for i=1,-.05,-.05 do
  154. wait()
  155. a:FindFirstChild("Mesh").Scale = Vector3.new(i,i,i)
  156. a.Transparency = a.Transparency + .05
  157. end
  158. a:Destroy()
  159. end,{p})
  160. if h or num > 300 then
  161. local cf = p.CFrame
  162. for i=1,3 do Smoke(cf*CFrame.new(0,4,0),"Black")end
  163. crownExplode(CFrame.new(cf.x,cf.y,cf.z),"Black",2)
  164. quickSound(asset..sounds["explode"],2)
  165. checkDmgArea(cf,dmg,10)
  166. p:Destroy()
  167. connect:disconnect()
  168. end
  169. end)
  170. end
  171. function Fire()
  172. Attacking = true
  173. for i=1,10 do
  174. wait(1/30)
  175. local speed = i/10
  176. rs.C0 = cslerp(rs.C0,c0rs*CFrame.Angles(-math.pi/2.5,0,0),speed)
  177. ls.C0 = cslerp(ls.C0,c0ls*CFrame.Angles(-math.pi/2.5,0,0),speed)
  178. tw.C0 = cslerp(tw.C0,c0tw*CFrame.Angles(0,math.pi/2,0),speed)
  179. end
  180. local b = Part("Bullet",char,Vector3.new(4,4,4),torso.CFrame,"Black",0,false,false,"SmoothPlastic")
  181. Mesh(b,"Sphere")
  182. local w = Weld(torso,b,CFrame.new(0,0,-.5))
  183. for i=1,5 do
  184. wait(1/30)
  185. local speed = i/5
  186. rs.C0 = cslerp(rs.C0,c0rs*CFrame.Angles(math.pi/2.5,0,0),speed)
  187. ls.C0 = cslerp(ls.C0,c0ls*CFrame.Angles(math.pi/2.5,0,0),speed)
  188. tw.C0 = cslerp(tw.C0,c0tw,speed)
  189. w.C0 = cslerp(w.C0,CFrame.new(0,5,-3),speed)
  190. end
  191. Shoot(b.CFrame,52.5)
  192. b:Destroy()
  193. for i=1,10 do
  194. wait(1/30)
  195. local speed = i/20
  196. rs.C0 = cslerp(rs.C0,c0rs,speed)
  197. ls.C0 = cslerp(ls.C0,c0ls,speed)
  198. tw.C0 = cslerp(tw.C0,c0tw,speed)
  199. end
  200. Attacking = false
  201. end
  202. ---------------------------------------------
  203. pcall(function()char:FindFirstChild("CAR"):Destroy()end)
  204. model = Instance.new("Model",char)
  205. model.Name = "CAR"
  206. base = Part("P",model,Vector3.new(6,6,6),torso.CFrame*CFrame.new(6,6,0),colour,0,false,false,"Plastic")
  207. torso.CFrame = base.CFrame
  208. basem = Mesh(base,"Sphere",Vector3.new(1,.5,1))
  209. side = Part("P",model,Vector3.new(6,2,6),torso.CFrame*CFrame.new(6,6,0),colour,0,false,false,"Plastic")
  210. sidem = Mesh(side,"FileMesh",Vector3.new(5.375,5.375,20),asset..meshes["ring"])
  211. sidew = Weld(base,side,CFrame.new(0,1,0)*CFrame.Angles(math.pi/2,0,0))
  212. side2 = Part("P",model,Vector3.new(6,2,6),torso.CFrame*CFrame.new(6,6,0),scolour,0,false,false,"Plastic")
  213. side2m = Mesh(side2,"FileMesh",Vector3.new(5.375,5.375,5),asset..meshes["ring"])
  214. side2w = Weld(side,side2,CFrame.new(0,0,-1.25))
  215. under = Part("P",model,Vector3.new(2,6,2),torso.CFrame*CFrame.new(6,6,0),scolour,0,false,false,"Plastic")
  216. underm = Mesh(under,"FileMesh",Vector3.new(2,6,2),asset..meshes["spike"])
  217. underw = Weld(base,under,CFrame.new(0,-1,0)*CFrame.Angles(math.pi,0,0))
  218. prop = Part("P",model,Vector3.new(0.5,0,4),torso.CFrame*CFrame.new(6,6,0),scolour,0,false,false,"Plastic")
  219. propm = Mesh(prop,"Sphere")
  220. propw = Weld(under,prop,CFrame.new(0,2.25,0))
  221. torweld = Weld(base,root,CFrame.new(0,3,-1))
  222. bp = Instance.new("BodyPosition")
  223. bp.maxForce = Vector3.new(0,1/0,0)
  224. bv = Instance.new("BodyVelocity")
  225. bv.maxForce = Vector3.new(1/0,0,1/0)
  226. bg = Instance.new("BodyGyro")
  227. bg.maxTorque = Vector3.new(1/0,1/0,1/0)
  228. humanoid.WalkSpeed = 0
  229. ---------------------------------------------
  230. mouse.KeyDown:connect(function(key)
  231. key:lower()
  232. keysdown[key] = true
  233. end)
  234. mouse.KeyUp:connect(function(key)
  235. key:lower()
  236. keysdown[key] = false
  237. end)
  238. mouse.Button1Down:connect(function()
  239. if not Attacking then
  240. Fire()
  241. end
  242. end)
  243. local function bn(key) return keysdown[key]and 1 or 0 end
  244. ---------------------------------------------
  245. step:connect(function()
  246. hover = hover-bn("e")+bn("q")
  247. bp.Parent,bg.Parent,bv.Parent = base,base,base
  248. bp.position = Vector3.new(0,math.sin(tick())+hover,0)
  249. bg.cframe = workspace.CurrentCamera.CoordinateFrame
  250. local vel = workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(Vector3.new(0-bn("a")+bn("d"),0,0-bn("w")+bn("s")))*Vector3.new(1,0,1)
  251. bv.velocity = (vel.magnitude > 0 and vel.unit*carspeed)or Vector3.new(0,0,0)
  252. propw.C0 = propw.C0*CFrame.Angles(0,.2,0)
  253. end)
Add Comment
Please, Sign In to add comment