Advertisement
frog2128

Untitled

Mar 11th, 2015
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 52.68 KB | None | 0 0
  1. --[[
  2. Made by Fenrier.
  3. ]]
  4. Player=game:GetService("Players").LocalPlayer
  5. Character=Player.Character
  6. PlayerGui=Player.PlayerGui
  7. Backpack=Player.Backpack
  8. Torso=Character.Torso
  9. Head=Character.Head
  10. Humanoid=Character.Humanoid
  11. LeftArm=Character["Left Arm"]
  12. LeftLeg=Character["Left Leg"]
  13. RightArm=Character["Right Arm"]
  14. RightLeg=Character["Right Leg"]
  15. LS=Torso["Left Shoulder"]
  16. LH=Torso["Left Hip"]
  17. RS=Torso["Right Shoulder"]
  18. RH=Torso["Right Hip"]
  19. Neck=Torso.Neck
  20. it=Instance.new
  21. vt=Vector3.new
  22. cf=CFrame.new
  23. euler=CFrame.fromEulerAnglesXYZ
  24. angles=CFrame.Angles
  25. necko=cf(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  26. necko2=cf(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  27. LHC0=cf(-1,-1,0,-0,-0,-1,0,1,0,1,0,0)
  28. LHC1=cf(-0.5,1,0,-0,-0,-1,0,1,0,1,0,0)
  29. RHC0=cf(1,-1,0,0,0,1,0,1,0,-1,-0,-0)
  30. RHC1=cf(0.5,1,0,0,0,1,0,1,0,-1,-0,-0)
  31. RootPart=Character.HumanoidRootPart
  32. RootJoint=RootPart.RootJoint
  33. RootCF=euler(-1.57,0,3.14)
  34. attack=false
  35. attackdebounce=false
  36. MMouse=nil
  37. combo=0
  38. mana=0
  39. heatcooldown=false
  40. aimrailgun=false
  41. aimcannon=false
  42. RailgunTarget=RootPart
  43. CannonTarget=RootPart
  44. changetarget=false
  45. local circle=0
  46. bladeattack=false
  47. --player
  48. player=nil
  49. --save shoulders
  50. RSH, LSH=nil, nil
  51. --welds
  52. RW, LW=Instance.new("Weld"), Instance.new("Weld")
  53. RW.Name="Right Shoulder" LW.Name="Left Shoulder"
  54. LH=Torso["Left Hip"]
  55. RH=Torso["Right Hip"]
  56. Asset="http://www.roblox.com/asset/?id="
  57.  
  58. function swait(num)
  59. if num==0 or num==nil then
  60. game:service'RunService'.RenderStepped:wait()
  61. else
  62. for i=0,num do
  63. game:service'RunService'.RenderStepped:wait()
  64. end
  65. end
  66. end
  67.  
  68. if Character:findFirstChild("Railgun",true) ~= nil then
  69. Character:findFirstChild("Railgun",true).Parent = nil
  70. end
  71. if Character:findFirstChild("Plasma Cannon",true) ~= nil then
  72. Character:findFirstChild("Plasma Cannon",true).Parent = nil
  73. end
  74. if Character:findFirstChild("Vanguard Blades",true) ~= nil then
  75. Character:findFirstChild("Vanguard Blades",true).Parent = nil
  76. end
  77. if Player.PlayerGui:findFirstChild("WeaponGUI",true) ~= nil then
  78. Player.PlayerGui:findFirstChild("WeaponGUI",true).Parent = nil
  79. end
  80.  
  81.  
  82. function NoOutline(Part)
  83. Part.TopSurface,Part.BottomSurface,Part.LeftSurface,Part.RightSurface,Part.FrontSurface,Part.BackSurface = 10,10,10,10,10,10
  84. end
  85.  
  86. function part(formfactor,parent,reflectance,transparency,brickcolor,name,size)
  87. local fp=it("Part")
  88. fp.formFactor=formfactor
  89. fp.Parent=parent
  90. fp.Reflectance=reflectance
  91. fp.Transparency=transparency
  92. fp.CanCollide=false
  93. fp.Locked=true
  94. fp.BrickColor=brickcolor
  95. fp.Name=name
  96. fp.Size=size
  97. fp.Position=Torso.Position
  98. NoOutline(fp)
  99. fp.Material="SmoothPlastic"
  100. fp:BreakJoints()
  101. return fp
  102. end
  103.  
  104. function mesh(Mesh,part,meshtype,meshid,offset,scale)
  105. local mesh=it(Mesh)
  106. mesh.Parent=part
  107. if Mesh=="SpecialMesh" then
  108. mesh.MeshType=meshtype
  109. mesh.MeshId=meshid
  110. end
  111. mesh.Offset=offset
  112. mesh.Scale=scale
  113. return mesh
  114. end
  115.  
  116. function weld(parent,part0,part1,c0)
  117. local weld=it("Weld")
  118. weld.Parent=parent
  119. weld.Part0=part0
  120. weld.Part1=part1
  121. weld.C0=c0
  122. return weld
  123. end
  124.  
  125. local fengui=it("GuiMain")
  126. fengui.Parent=Player.PlayerGui
  127. fengui.Name="WeaponGUI"
  128.  
  129. local Color1=BrickColor.new("White")
  130. local Color2=BrickColor.new("Bright blue")
  131. local Color3=BrickColor.new("Really black")
  132.  
  133. local model1=Instance.new("Model")
  134. model1.Parent=Character
  135. model1.Name="Railgun"
  136. Railgun={}
  137. RailgunWelds={}
  138. local model2=Instance.new("Model")
  139. model2.Parent=Character
  140. model2.Name="Plasma Cannon"
  141. Plasma={}
  142. PlasmaWelds={}
  143. local model3=Instance.new("Model")
  144. model3.Parent=Character
  145. model3.Name="Vanguard Blades"
  146.  
  147. prt1=part(3,model1,0,0,Color1,"Part1",vt())
  148. prt2=part(3,model1,0,0,Color2,"Part2",vt())
  149. prt3=part(3,model1,0,0,Color2,"Part3",vt())
  150. prt4=part(3,model1,0,0,Color2,"Part4",vt())
  151. prt5=part(3,model1,0,0,Color2,"Part5",vt())
  152. prt6=part(3,model1,0,0,Color2,"Part6",vt())
  153. prt7=part(3,model1,0,0,Color1,"Part7",vt())
  154. prt8=part(3,model1,0,0,Color3,"Part8",vt())
  155. prt9=part(3,model1,0,0,Color1,"Part9",vt())
  156. prt10=part(3,model1,0,0,Color1,"Part10",vt())
  157. prt11=part(3,model1,0,0,Color1,"Part11",vt())
  158. prt12=part(3,model1,0,0,Color1,"Part12",vt())
  159. prt13=part(3,model1,0,0,Color1,"Part13",vt())
  160. prt14=part(3,model1,0,0,Color1,"Part14",vt())
  161. prt15=part(3,model1,0,0,Color1,"Part15",vt())
  162. prt16=part(3,model1,0,0,Color1,"Part16",vt())
  163. prt17=part(3,model1,0,0,Color1,"Part17",vt())
  164. prt18=part(3,model1,0,0,Color2,"Part18",vt())
  165. prt19=part(3,model1,0,0,Color2,"Part19",vt())
  166. prt20=part(3,model1,0.2,0,Color1,"Part20",vt())
  167. prt21=part(3,model1,0.2,0,Color1,"Part21",vt())
  168. prt22=part(3,model1,0.5,0,Color1,"Part22",vt())
  169. prt23=part(3,model1,0.5,0,Color1,"Part23",vt())
  170. prt24=part(3,model1,0,0,Color2,"Part24",vt())
  171. prt25=part(3,model1,0,0,Color2,"Part25",vt())
  172. prt26=part(3,model1,0.2,0,Color1,"Part26",vt())
  173. prt27=part(3,model1,0.2,0,Color1,"Part27",vt())
  174. prt28=part(3,model1,0.5,0,Color1,"Part28",vt())
  175. prt29=part(3,model1,0.5,0,Color1,"Part29",vt())
  176. prt30=part(3,model1,0,0,Color2,"Part30",vt())
  177. prt31=part(3,model1,0,0,Color2,"Part31",vt())
  178. prt32=part(3,model1,0.2,0,Color1,"Part32",vt())
  179. prt33=part(3,model1,0.2,0,Color1,"Part33",vt())
  180. prt34=part(3,model1,0.5,0,Color1,"Part34",vt())
  181. prt35=part(3,model1,0.5,0,Color1,"Part35",vt())
  182. for _,c in pairs(model1:children()) do
  183. table.insert(Railgun,c)
  184. end
  185. --
  186. aprt1=part(3,model2,0,0,Color1,"aPart1",vt())
  187. aprt2=part(3,model2,0,0,Color2,"aPart2",vt())
  188. aprt3=part(3,model2,0,0,Color2,"aPart3",vt())
  189. aprt4=part(3,model2,0,0,Color2,"aPart4",vt())
  190. aprt5=part(3,model2,0,0,Color2,"aPart5",vt())
  191. aprt6=part(3,model2,0,0,Color2,"aPart6",vt())
  192. aprt7=part(3,model2,0,0,Color2,"aPart7",vt())
  193. aprt8=part(3,model2,0,0,Color1,"aPart8",vt())
  194. aprt9=part(3,model2,0,0,Color1,"aPart9",vt())
  195. aprt10=part(3,model2,0,0,Color3,"aPart10",vt())
  196. aprt11=part(3,model2,0,0,Color3,"aPart11",vt())
  197. aprt12=part(3,model2,0,0,Color1,"aPart12",vt())
  198. aprt13=part(3,model2,0,0,Color1,"aPart13",vt())
  199. aprt14=part(3,model2,0,0,Color1,"aPart14",vt())
  200. aprt15=part(3,model2,0,0,Color1,"aPart15",vt())
  201. aprt16=part(3,model2,0,0,Color1,"aPart16",vt())
  202. aprt17=part(3,model2,0,0,Color1,"aPart17",vt())
  203. aprt18=part(3,model2,0,0,Color1,"aPart18",vt())
  204. aprt19=part(3,model2,0,0,Color2,"aPart19",vt())
  205. aprt20=part(3,model2,0,0,Color2,"aPart20",vt())
  206. aprt21=part(3,model2,0.2,0,Color1,"aPart21",vt())
  207. aprt22=part(3,model2,0.2,0,Color1,"aPart22",vt())
  208. aprt23=part(3,model2,0.5,0,Color1,"aPart23",vt())
  209. aprt24=part(3,model2,0.5,0,Color1,"aPart24",vt())
  210. aprt25=part(3,model2,0,0,Color2,"aPart25",vt())
  211. aprt26=part(3,model2,0,0,Color2,"aPart26",vt())
  212. aprt27=part(3,model2,0.2,0,Color1,"aPart27",vt())
  213. aprt28=part(3,model2,0.2,0,Color1,"aPart28",vt())
  214. aprt29=part(3,model2,0.5,0,Color1,"aPart29",vt())
  215. aprt30=part(3,model2,0.5,0,Color1,"aPart30",vt())
  216. aprt31=part(3,model2,0,0,Color2,"aPart31",vt())
  217. aprt32=part(3,model2,0,0,Color2,"aPart32",vt())
  218. aprt33=part(3,model2,0.2,0,Color1,"aPart33",vt())
  219. aprt34=part(3,model2,0.2,0,Color1,"aPart34",vt())
  220. aprt35=part(3,model2,0.5,0,Color1,"aPart35",vt())
  221. aprt36=part(3,model2,0.5,0,Color1,"aPart36",vt())
  222. aprt37=part(3,model2,0,0,Color2,"aPart37",vt())
  223. aprt38=part(3,model1,0,0,Color1,"aPart38",vt())
  224. aprt39=part(3,model1,0,0,Color1,"aPart39",vt())
  225. for _,c in pairs(model2:children()) do
  226. table.insert(Plasma,c)
  227. end
  228. --
  229. bref=part(3,model3,0,0,Color3,"bRef",vt())
  230. bprt1=part(3,model3,0,1,Color1,"bPart1",vt())
  231. bprt2=part(3,model3,0,0,Color1,"bPart2",vt())
  232. bprt3=part(3,model3,0,0,Color2,"bPart3",vt())
  233. bprt4=part(3,model3,0.5,0,Color1,"bPart4",vt())
  234. bprt5=part(3,model3,0.5,0,Color1,"bPart5",vt())
  235. bprt6=part(3,model3,0.5,0,Color1,"bPart6",vt())
  236. bprt7=part(3,model3,0,1,Color1,"bPart7",vt())
  237. bprt8=part(3,model3,0,0,Color1,"bPart8",vt())
  238. bprt9=part(3,model3,0,0,Color2,"bPart9",vt())
  239. bprt10=part(3,model3,0.5,0,Color1,"bPart10",vt())
  240. bprt11=part(3,model3,0.5,0,Color1,"bPart11",vt())
  241. bprt12=part(3,model3,0.5,0,Color1,"bPart12",vt())
  242. bprt13=part(3,model3,0,1,Color1,"bPart13",vt())
  243. bprt14=part(3,model3,0,0,Color1,"bPart14",vt())
  244. bprt15=part(3,model3,0,0,Color2,"bPart15",vt())
  245. bprt16=part(3,model3,0.5,0,Color1,"bPart16",vt())
  246. bprt17=part(3,model3,0.5,0,Color1,"bPart17",vt())
  247. bprt18=part(3,model3,0.5,0,Color1,"bPart18",vt())
  248.  
  249. msh1=mesh("BlockMesh",prt1,"","",vt(0,0,0),vt(1,1,1))
  250. msh2=mesh("BlockMesh",prt2,"","",vt(0,0,0),vt(1.3,2.5,10))
  251. msh3=mesh("BlockMesh",prt3,"","",vt(0,0,0),vt(1.49,2.5,5))
  252. msh4=mesh("BlockMesh",prt4,"","",vt(0,0,0),vt(1.51,2.5,3))
  253. msh5=mesh("CylinderMesh",prt5,"","",vt(0,0,0),vt(2.5,1,2.5))
  254. msh6=mesh("CylinderMesh",prt6,"","",vt(0,0,0),vt(1.5,16,1.5))
  255. msh7=mesh("CylinderMesh",prt7,"","",vt(0,0,0),vt(1.6,1,1.6))
  256. msh8=mesh("CylinderMesh",prt8,"","",vt(0,0,0),vt(1.4,1.01,1.4))
  257. msh9=mesh("BlockMesh",prt9,"","",vt(0,0,0),vt(1.4,14,2))
  258. msh10=mesh("SpecialMesh",prt10,"Wedge","",vt(0,0,0),vt(1.3,4,3))
  259. msh11=mesh("SpecialMesh",prt11,"Wedge","",vt(0,0,0),vt(1.3,2,3))
  260. msh12=mesh("SpecialMesh",prt12,"Wedge","",vt(0,0,0),vt(1.7,3,3.5))
  261. msh13=mesh("BlockMesh",prt13,"","",vt(0,0,0),vt(1.5,1.5,1.5))
  262. msh14=mesh("BlockMesh",prt14,"","",vt(0,0,0),vt(1.6,4.5,2))
  263. msh15=mesh("BlockMesh",prt15,"","",vt(0,0,0),vt(1.6,3.6,2))
  264. msh16=mesh("SpecialMesh",prt16,"Wedge","",vt(0,0,0),vt(0.5,3,3.5))
  265. msh17=mesh("SpecialMesh",prt17,"Wedge","",vt(0,0,0),vt(0.5,2,4))
  266. msh19=mesh("SpecialMesh",prt19,"Sphere","",vt(0,0,0),vt(1.5,1.5,1.5))
  267. msh20=mesh("SpecialMesh",prt20,"Wedge","",vt(0,0,0),vt(0.2,8,0.5))
  268. msh21=mesh("SpecialMesh",prt21,"Wedge","",vt(0,0,0),vt(0.2,8,0.5))
  269. msh22=mesh("SpecialMesh",prt22,"Wedge","",vt(0,0,0),vt(0.3,7,0.7))
  270. msh23=mesh("SpecialMesh",prt23,"Wedge","",vt(0,0,0),vt(0.3,7,0.7))
  271. msh25=mesh("SpecialMesh",prt25,"Sphere","",vt(0,0,0),vt(1.5,1.5,1.5))
  272. msh26=mesh("SpecialMesh",prt26,"Wedge","",vt(0,0,0),vt(0.2,8,0.5))
  273. msh27=mesh("SpecialMesh",prt27,"Wedge","",vt(0,0,0),vt(0.2,8,0.5))
  274. msh28=mesh("SpecialMesh",prt28,"Wedge","",vt(0,0,0),vt(0.3,7,0.7))
  275. msh29=mesh("SpecialMesh",prt29,"Wedge","",vt(0,0,0),vt(0.3,7,0.7))
  276. msh31=mesh("SpecialMesh",prt31,"Sphere","",vt(0,0,0),vt(1.5,1.5,1.5))
  277. msh32=mesh("SpecialMesh",prt32,"Wedge","",vt(0,0,0),vt(0.2,8,0.5))
  278. msh33=mesh("SpecialMesh",prt33,"Wedge","",vt(0,0,0),vt(0.2,8,0.5))
  279. msh34=mesh("SpecialMesh",prt34,"Wedge","",vt(0,0,0),vt(0.3,7,0.7))
  280. msh35=mesh("SpecialMesh",prt35,"Wedge","",vt(0,0,0),vt(0.3,7,0.7))
  281. --
  282. msh1=mesh("BlockMesh",aprt1,"","",vt(0,0,0),vt(1,1,1))
  283. msh2=mesh("BlockMesh",aprt2,"","",vt(0,0,0),vt(2,1.3,5))
  284. msh3=mesh("SpecialMesh",aprt3,"Wedge","",vt(0,0,0),vt(2,2,1))
  285. msh4=mesh("BlockMesh",aprt4,"","",vt(0,0,0),vt(2,2,6))
  286. msh5=mesh("BlockMesh",aprt5,"","",vt(0,0,0),vt(2,2,2))
  287. msh6=mesh("CylinderMesh",aprt6,"","",vt(0,0,0),vt(2,5,2))
  288. msh7=mesh("CylinderMesh",aprt7,"","",vt(0,0,0),vt(2,5,2))
  289. msh8=mesh("CylinderMesh",aprt8,"","",vt(0,0,0),vt(2.1,1,2.1))
  290. msh9=mesh("CylinderMesh",aprt9,"","",vt(0,0,0),vt(2.1,1,2.1))
  291. msh10=mesh("CylinderMesh",aprt10,"","",vt(0,0,0),vt(1.9,1.01,1.9))
  292. msh11=mesh("CylinderMesh",aprt11,"","",vt(0,0,0),vt(1.9,1.01,1.9))
  293. msh12=mesh("CylinderMesh",aprt12,"","",vt(0,0,0),vt(2.2,5.5,2.2))
  294. msh13=mesh("SpecialMesh",aprt13,"Wedge","",vt(0,0,0),vt(1.7,3,3.5))
  295. msh14=mesh("BlockMesh",aprt14,"","",vt(0,0,0),vt(1.5,1.5,1.5))
  296. msh15=mesh("BlockMesh",aprt15,"","",vt(0,0,0),vt(1.6,4.5,2))
  297. msh16=mesh("BlockMesh",aprt16,"","",vt(0,0,0),vt(1.6,3.6,2))
  298. msh17=mesh("SpecialMesh",aprt17,"Wedge","",vt(0,0,0),vt(0.5,3,3.5))
  299. msh18=mesh("SpecialMesh",aprt18,"Wedge","",vt(0,0,0),vt(0.5,2,4))
  300. msh20=mesh("SpecialMesh",aprt20,"Sphere","",vt(0,0,0),vt(1.5,1.5,1.5))
  301. msh21=mesh("SpecialMesh",aprt21,"Wedge","",vt(0,0,0),vt(0.2,8,0.5))
  302. msh22=mesh("SpecialMesh",aprt22,"Wedge","",vt(0,0,0),vt(0.2,8,0.5))
  303. msh23=mesh("SpecialMesh",aprt23,"Wedge","",vt(0,0,0),vt(0.3,7,0.7))
  304. msh24=mesh("SpecialMesh",aprt24,"Wedge","",vt(0,0,0),vt(0.3,7,0.7))
  305. msh26=mesh("SpecialMesh",aprt26,"Sphere","",vt(0,0,0),vt(1.5,1.5,1.5))
  306. msh27=mesh("SpecialMesh",aprt27,"Wedge","",vt(0,0,0),vt(0.2,8,0.5))
  307. msh28=mesh("SpecialMesh",aprt28,"Wedge","",vt(0,0,0),vt(0.2,8,0.5))
  308. msh29=mesh("SpecialMesh",aprt29,"Wedge","",vt(0,0,0),vt(0.3,7,0.7))
  309. msh30=mesh("SpecialMesh",aprt30,"Wedge","",vt(0,0,0),vt(0.3,7,0.7))
  310. msh32=mesh("SpecialMesh",aprt32,"Sphere","",vt(0,0,0),vt(1.5,1.5,1.5))
  311. msh33=mesh("SpecialMesh",aprt33,"Wedge","",vt(0,0,0),vt(0.2,8,0.5))
  312. msh34=mesh("SpecialMesh",aprt34,"Wedge","",vt(0,0,0),vt(0.2,8,0.5))
  313. msh35=mesh("SpecialMesh",aprt35,"Wedge","",vt(0,0,0),vt(0.3,7,0.7))
  314. msh36=mesh("SpecialMesh",aprt36,"Wedge","",vt(0,0,0),vt(0.3,7,0.7))
  315. msh37=mesh("BlockMesh",aprt37,"","",vt(0,0,0),vt(1.51,2.5,3))
  316. msh38=mesh("SpecialMesh",aprt38,"Wedge","",vt(0,0,0),vt(1.3,4,3))
  317. msh39=mesh("SpecialMesh",aprt39,"Wedge","",vt(0,0,0),vt(1.3,2,3))
  318. --
  319. msh2=mesh("CylinderMesh",bprt2,"","",vt(0,0,0),vt(3,1,3))
  320. msh3=mesh("CylinderMesh",bprt3,"","",vt(0,0,0),vt(2.5,1.01,2.5))
  321. msh4=mesh("BlockMesh",bprt4,"","",vt(0,0,0),vt(7,0.5,1.5))
  322. msh5=mesh("SpecialMesh",bprt5,"Wedge","",vt(0,0,0),vt(0.5,1.5,10))
  323. msh6=mesh("SpecialMesh",bprt6,"Wedge","",vt(0,0,0),vt(0.3,3,4))
  324. msh8=mesh("CylinderMesh",bprt8,"","",vt(0,0,0),vt(3,1,3))
  325. msh9=mesh("CylinderMesh",bprt9,"","",vt(0,0,0),vt(2.5,1.01,2.5))
  326. msh10=mesh("BlockMesh",bprt10,"","",vt(0,0,0),vt(7,0.5,1.5))
  327. msh11=mesh("SpecialMesh",bprt11,"Wedge","",vt(0,0,0),vt(0.5,1.5,10))
  328. msh12=mesh("SpecialMesh",bprt12,"Wedge","",vt(0,0,0),vt(0.3,3,4))
  329. msh14=mesh("CylinderMesh",bprt14,"","",vt(0,0,0),vt(3,1,3))
  330. msh15=mesh("CylinderMesh",bprt15,"","",vt(0,0,0),vt(2.5,1.01,2.5))
  331. msh16=mesh("BlockMesh",bprt16,"","",vt(0,0,0),vt(7,0.5,1.5))
  332. msh17=mesh("SpecialMesh",bprt17,"Wedge","",vt(0,0,0),vt(0.5,1.5,10))
  333. msh18=mesh("SpecialMesh",bprt18,"Wedge","",vt(0,0,0),vt(0.3,3,4))
  334.  
  335. --wld1=weld(prt1,prt1,Torso,euler(0.5,-3.14,0)*cf(2,-2,-2))
  336. wld1=weld(prt1,prt1,Torso,euler(2.4,0,0)*cf(2,-2,-2))
  337. wld2=weld(prt1,prt2,prt1,euler(0,0,0)*cf(0,0,0))
  338. wld3=weld(prt1,prt3,prt2,euler(-0.3,0,0)*cf(0,0.05,-1))
  339. wld4=weld(prt1,prt4,prt2,euler(-0.5,0,0)*cf(0,0.1,-0.3))
  340. wld5=weld(prt1,prt5,prt4,euler(1.57+0.5,0,0)*cf(0,-0.2,0))
  341. wld6=weld(prt1,prt6,prt2,euler(1.57,0,0)*cf(0,-0.11,1.1))
  342. wld7=weld(prt1,prt7,prt6,euler(0,0,0)*cf(0,-1.6,0))
  343. wld8=weld(prt1,prt8,prt7,euler(0,0,0)*cf(0,0,0))
  344. wld9=weld(prt1,prt9,prt6,euler(0,0,0)*cf(0,-0.3,0.2))
  345. wld10=weld(prt1,prt10,prt9,euler(0,0,0)*cf(0,1.2,0.4))
  346. wld11=weld(prt1,prt11,prt10,euler(0,0,3.14)*cf(0,0.6,0))
  347. wld12=weld(prt1,prt12,prt5,euler(3.14,0,0)*cf(0,-0.2,-0.55))
  348. wld13=weld(prt1,prt13,prt12,euler(0.785,0,0)*cf(0,0.2,-0.4))
  349. wld14=weld(prt1,prt14,prt12,euler(0,0,0)*cf(0,-0.4,-0.2))
  350. wld15=weld(prt1,prt15,prt14,euler(-0.8,0,0)*cf(0,-0.55,-0.2))
  351. wld16=weld(prt1,prt16,prt14,euler(0,0,3.14)*cf(0,-0.15,0.5))
  352. wld17=weld(prt1,prt17,prt16,euler(0,0,3.14)*cf(0,0.5,-0.3))
  353. wld18=weld(prt1,prt18,prt2,euler(0,0,0)*cf(0.2,0,0)) --1
  354. wld19=weld(prt1,prt19,prt18,euler(0,0,0.5)*cf(0,0,0))
  355. wld20=weld(prt1,prt20,prt19,euler(3.14,3.14,0)*cf(0,0.8,0.05))
  356. wld21=weld(prt1,prt21,prt19,euler(3.14,0,0)*cf(0,0.8,-0.05))
  357. wld22=weld(prt1,prt22,prt20,euler(0,0,0)*cf(0,-0.5,0.02))
  358. wld23=weld(prt1,prt23,prt21,euler(0,0,0)*cf(0,-0.5,0.02))
  359. wld24=weld(prt1,prt24,prt2,euler(0,0,0)*cf(0.2,-0.1,-0.3)) --2
  360. wld25=weld(prt1,prt25,prt24,euler(0.3,0,0.6)*cf(0,0,0))
  361. wld26=weld(prt1,prt26,prt25,euler(3.14,3.14,0)*cf(0,0.8,0.05))
  362. wld27=weld(prt1,prt27,prt25,euler(3.14,0,0)*cf(0,0.8,-0.05))
  363. wld28=weld(prt1,prt28,prt26,euler(0,0,0)*cf(0,-0.5,0.02))
  364. wld29=weld(prt1,prt29,prt27,euler(0,0,0)*cf(0,-0.5,0.02))
  365. wld30=weld(prt1,prt30,prt2,euler(0,0,0)*cf(0.2,-0.2,-0.6)) --3
  366. wld31=weld(prt1,prt31,prt30,euler(0.6,0,0.7)*cf(0,0,0))
  367. wld32=weld(prt1,prt32,prt31,euler(3.14,3.14,0)*cf(0,0.8,0.05))
  368. wld33=weld(prt1,prt33,prt31,euler(3.14,0,0)*cf(0,0.8,-0.05))
  369. wld34=weld(prt1,prt34,prt32,euler(0,0,0)*cf(0,-0.5,0.02))
  370. wld35=weld(prt1,prt35,prt33,euler(0,0,0)*cf(0,-0.5,0.02))
  371. for _,c in pairs(prt1:children()) do
  372. if c.className=="Weld" then
  373. table.insert(RailgunWelds,c)
  374. end
  375. end
  376. --
  377. --awld1=weld(aprt1,aprt1,Torso,euler(0.5,3.14,0)*cf(-2,-2,-2))
  378. awld1=weld(aprt1,aprt1,Torso,euler(2.4,0,0)*cf(-2,-2,-2))
  379. awld2=weld(aprt1,aprt2,aprt1,euler(0,0,0)*cf(0,0,0))
  380. awld3=weld(aprt1,aprt3,aprt2,euler(0,3.14,0)*cf(0,-0.3,-0.4))
  381. awld4=weld(aprt1,aprt4,aprt2,euler(0,0,0)*cf(0,-0.3,0.3))
  382. awld5=weld(aprt1,aprt5,aprt4,euler(0,0,0)*cf(0,-0.3,0.2))
  383. awld6=weld(aprt1,aprt6,aprt4,euler(1.57,0,0)*cf(0,-0.02,0.7))
  384. awld7=weld(aprt1,aprt7,aprt4,euler(1.57,0,0)*cf(0,0.02,0.7))
  385. awld8=weld(aprt1,aprt8,aprt6,euler(0,0,0)*cf(0,-0.5,0))
  386. awld9=weld(aprt1,aprt9,aprt7,euler(0,0,0)*cf(0,-0.5,0))
  387. awld10=weld(aprt1,aprt10,aprt8,euler(0,0,0)*cf(0,0,0))
  388. awld11=weld(aprt1,aprt11,aprt9,euler(0,0,0)*cf(0,0,0))
  389. awld12=weld(aprt1,aprt12,aprt4,euler(1.57,0,0)*cf(0,0.2,0.75))
  390. awld13=weld(aprt1,aprt13,aprt5,euler(-1.57,0,0)*cf(0,-0.3,0))
  391. awld14=weld(aprt1,aprt14,aprt13,euler(0.785,0,0)*cf(0,0.2,-0.4))
  392. awld15=weld(aprt1,aprt15,aprt13,euler(0,0,0)*cf(0,-0.4,-0.2))
  393. awld16=weld(aprt1,aprt16,aprt15,euler(-0.8,0,0)*cf(0,-0.55,-0.2))
  394. awld17=weld(aprt1,aprt17,aprt15,euler(0,0,3.14)*cf(0,-0.15,0.5))
  395. awld18=weld(aprt1,aprt18,aprt17,euler(0,0,3.14)*cf(0,0.5,-0.3))
  396. awld19=weld(aprt1,aprt19,aprt2,euler(0,0,0)*cf(-0.2,-0.2,0.7)) --1
  397. awld20=weld(aprt1,aprt20,aprt19,euler(0,0,-0.5)*cf(0,0,0))
  398. awld21=weld(aprt1,aprt21,aprt20,euler(3.14,3.14,0)*cf(0,0.8,0.05))
  399. awld22=weld(aprt1,aprt22,aprt20,euler(3.14,0,0)*cf(0,0.8,-0.05))
  400. awld23=weld(aprt1,aprt23,aprt21,euler(0,0,0)*cf(0,-0.5,0.02))
  401. awld24=weld(aprt1,aprt24,aprt22,euler(0,0,0)*cf(0,-0.5,0.02))
  402. awld25=weld(aprt1,aprt25,aprt2,euler(0,0,0)*cf(-0.2,-0.3,0.4)) --2
  403. awld26=weld(aprt1,aprt26,aprt25,euler(0.3,0,-0.6)*cf(0,0,0))
  404. awld27=weld(aprt1,aprt27,aprt26,euler(3.14,3.14,0)*cf(0,0.8,0.05))
  405. awld28=weld(aprt1,aprt28,aprt26,euler(3.14,0,0)*cf(0,0.8,-0.05))
  406. awld29=weld(aprt1,aprt29,aprt27,euler(0,0,0)*cf(0,-0.5,0.02))
  407. awld30=weld(aprt1,aprt30,aprt28,euler(0,0,0)*cf(0,-0.5,0.02))
  408. awld31=weld(aprt1,aprt31,aprt2,euler(0,0,0)*cf(-0.2,-0.4,0.1)) --3
  409. awld32=weld(aprt1,aprt32,aprt31,euler(0.6,0,-0.7)*cf(0,0,0))
  410. awld33=weld(aprt1,aprt33,aprt32,euler(3.14,3.14,0)*cf(0,0.8,0.05))
  411. awld34=weld(aprt1,aprt34,aprt32,euler(3.14,0,0)*cf(0,0.8,-0.05))
  412. awld35=weld(aprt1,aprt35,aprt33,euler(0,0,0)*cf(0,-0.5,0.02))
  413. awld36=weld(aprt1,aprt36,aprt34,euler(0,0,0)*cf(0,-0.5,0.02))
  414. awld37=weld(aprt1,aprt37,aprt2,euler(-0.5,0,0)*cf(0,-0.05,-0.1))
  415. awld38=weld(aprt1,aprt38,aprt37,euler(-1.57,3.14,0)*cf(0,0.2,0.15))
  416. awld39=weld(aprt1,aprt339,aprt39,euler(0,0,3.14)*cf(0,0.6,0))
  417. for _,c in pairs(aprt1:children()) do
  418. if c.className=="Weld" then
  419. table.insert(PlasmaWelds,c)
  420. end
  421. end
  422. --
  423. brefwld=weld(bref,bref,Torso,euler(0,0,0)*cf(0,0,0))
  424. bwld1=weld(bprt1,bprt1,bref,euler(0,0,0)*cf(1,-0.6,-2)) --1
  425. bwld2=weld(bprt1,bprt2,bprt1,euler(0,0.5,1.57+0.4)*cf(0,0,0))
  426. bwld3=weld(bprt1,bprt3,bprt2,euler(0,0,0)*cf(0,0,0))
  427. bwld4=weld(bprt1,bprt4,bprt2,euler(0,0,0)*cf(-0.8,0,0))
  428. bwld5=weld(bprt1,bprt5,bprt2,euler(-1.57,0,1.57)*cf(-0.8,0,-0.35))
  429. bwld6=weld(bprt1,bprt6,bprt4,euler(-1.57,0,1.57)*cf(-1.1,0,-0.15))
  430. bwld7=weld(bprt1,bprt7,bref,euler(0,0,0)*cf(0,-0.6,-2)) --2
  431. bwld8=weld(bprt1,bprt8,bprt7,euler(0,0.5,1.57)*cf(0,0,0))
  432. bwld9=weld(bprt1,bprt9,bprt8,euler(0,0,0)*cf(0,0,0))
  433. bwld10=weld(bprt1,bprt10,bprt8,euler(0,0,0)*cf(-0.8,0,0))
  434. bwld11=weld(bprt1,bprt11,bprt8,euler(-1.57,0,1.57)*cf(-0.8,0,-0.35))
  435. bwld12=weld(bprt1,bprt12,bprt10,euler(-1.57,0,1.57)*cf(-1.1,0,-0.15))
  436. bwld13=weld(bprt1,bprt13,bref,euler(0,0,0)*cf(-1,-0.6,-2)) --3
  437. bwld14=weld(bprt1,bprt14,bprt13,euler(0,0.5,1.57-0.4)*cf(0,0,0))
  438. bwld15=weld(bprt1,bprt15,bprt14,euler(0,0,0)*cf(0,0,0))
  439. bwld16=weld(bprt1,bprt16,bprt14,euler(0,0,0)*cf(-0.8,0,0))
  440. bwld17=weld(bprt1,bprt17,bprt14,euler(-1.57,0,1.57)*cf(-0.8,0,-0.35))
  441. bwld18=weld(bprt1,bprt18,bprt16,euler(-1.57,0,1.57)*cf(-1.1,0,-0.15))
  442.  
  443. local hitbox=part(3,nil,0,1,BrickColor.new("Black"),"Hitbox",vt(1,1,1))
  444. hitbox.Anchored=false
  445.  
  446. if (script.Parent.className~="HopperBin") then
  447. Tool=Instance.new("HopperBin")
  448. Tool.Parent=Backpack
  449. Tool.Name="Vanguard Gauntlets"
  450. script.Parent=Tool
  451. end
  452. Bin=script.Parent
  453. Bin=Tool
  454.  
  455. local bodvel=Instance.new("BodyVelocity")
  456. local bg=Instance.new("BodyGyro")
  457.  
  458. so = function(id,par,vol,pit)
  459. coroutine.resume(coroutine.create(function()
  460. local sou = Instance.new("Sound",par or workspace)
  461. sou.Volume=vol
  462. sou.Pitch=pit or 1
  463. sou.SoundId=id
  464. swait()
  465. sou:play()
  466. game:GetService("Debris"):AddItem(sou,6)
  467. end))
  468. end
  469.  
  470. function clerp(a,b,t)
  471. local qa = {QuaternionFromCFrame(a)}
  472. local qb = {QuaternionFromCFrame(b)}
  473. local ax, ay, az = a.x, a.y, a.z
  474. local bx, by, bz = b.x, b.y, b.z
  475. local _t = 1-t
  476. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  477. end
  478.  
  479. function QuaternionFromCFrame(cf)
  480. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  481. local trace = m00 + m11 + m22
  482. if trace > 0 then
  483. local s = math.sqrt(1 + trace)
  484. local recip = 0.5/s
  485. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  486. else
  487. local i = 0
  488. if m11 > m00 then
  489. i = 1
  490. end
  491. if m22 > (i == 0 and m00 or m11) then
  492. i = 2
  493. end
  494. if i == 0 then
  495. local s = math.sqrt(m00-m11-m22+1)
  496. local recip = 0.5/s
  497. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  498. elseif i == 1 then
  499. local s = math.sqrt(m11-m22-m00+1)
  500. local recip = 0.5/s
  501. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  502. elseif i == 2 then
  503. local s = math.sqrt(m22-m00-m11+1)
  504. local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  505. end
  506. end
  507. end
  508.  
  509. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  510. local xs, ys, zs = x + x, y + y, z + z
  511. local wx, wy, wz = w*xs, w*ys, w*zs
  512. local xx = x*xs
  513. local xy = x*ys
  514. local xz = x*zs
  515. local yy = y*ys
  516. local yz = y*zs
  517. local zz = z*zs
  518. return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
  519. end
  520.  
  521. function QuaternionSlerp(a, b, t)
  522. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  523. local startInterp, finishInterp;
  524. if cosTheta >= 0.0001 then
  525. if (1 - cosTheta) > 0.0001 then
  526. local theta = math.acos(cosTheta)
  527. local invSinTheta = 1/math.sin(theta)
  528. startInterp = math.sin((1-t)*theta)*invSinTheta
  529. finishInterp = math.sin(t*theta)*invSinTheta
  530. else
  531. startInterp = 1-t
  532. finishInterp = t
  533. end
  534. else
  535. if (1+cosTheta) > 0.0001 then
  536. local theta = math.acos(-cosTheta)
  537. local invSinTheta = 1/math.sin(theta)
  538. startInterp = math.sin((t-1)*theta)*invSinTheta
  539. finishInterp = math.sin(t*theta)*invSinTheta
  540. else
  541. startInterp = t-1
  542. finishInterp = t
  543. end
  544. end
  545. return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
  546. end
  547.  
  548. function hideanim()
  549. equipped=false
  550. n=2
  551. for i=0,1,0.05 do
  552. swait()
  553. --[[Torso.Neck.C0=necko*euler(0,0,0)
  554. RootJoint.C0=RootCF*euler(0,0,0)
  555. RW.C0=cf(1.5,0.5,0)*euler(0,0,0.5-0.5*i*n)
  556. RW.C1=cf(0,0.5,0)*euler(0,0,0)
  557. LW.C0=cf(-1.5,0.5,0)*euler(0,0,-0.5+0.5*i*n)
  558. LW.C1=cf(0,0.5,0)*euler(0,0,0)]]
  559. RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.4)
  560. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0),.4)
  561. RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(0,0,0),.4)
  562. LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,0),.4)
  563. wld1.C0=clerp(wld1.C0,euler(2.4,0,0)*cf(2,-2,-2),.4)
  564. awld1.C0=clerp(awld1.C0,euler(2.4,0,0)*cf(-2,-2,-2),.4)
  565. bwld1.C0=clerp(bwld1.C0,euler(0,0,0)*cf(1,-0.6,-2),.4)
  566. bwld7.C0=clerp(bwld7.C0,euler(0,0,0)*cf(0,-0.6,-2),.4)
  567. bwld13.C0=clerp(bwld13.C0,euler(0,0,0)*cf(-1,-0.6,-2),.4)
  568. bwld2.C0=clerp(bwld2.C0,euler(0,0.5,1.57+0.4)*cf(0,0,0),.4)
  569. bwld8.C0=clerp(bwld8.C0,euler(0,0.5,1.57)*cf(0,0,0),.4)
  570. bwld14.C0=clerp(bwld14.C0,euler(0,0.5,1.57-0.4)*cf(0,0,0),.4)
  571. brefwld.C0=clerp(brefwld.C0,euler(0,0,0)*cf(0,0,0),.4)
  572. n=n-0.1
  573. end
  574. Torso.Neck.C0=necko
  575. Torso.Neck.C1=necko2
  576. RootJoint.C0=RootCF
  577. RW.C0=cf(1.5,0.5,0)*euler(0,0,0)
  578. RW.C1=cf(0,0.5,0)*euler(0,0,0)
  579. LW.C0=cf(-1.5,0.5,0)*euler(0,0,0)
  580. LW.C1=cf(0,0.5,0)*euler(0,0,0)
  581. RH.C0=RHC0
  582. RH.C1=RHC1
  583. LH.C0=LHC0
  584. LH.C1=LHC1
  585. end
  586.  
  587. function equipanim()
  588. equipped=true
  589. circle=0
  590. n=2
  591. for i=0,1,0.1 do
  592. swait()
  593. --[[Torso.Neck.C0=necko*euler(0,0,0)
  594. RootJoint.C0=RootCF*euler(0,0,0)
  595. RW.C0=cf(1.5,0.5,0)*euler(0,0,0.5*i*n)
  596. RW.C1=cf(0,0.5,0)*euler(0,0,0)
  597. LW.C0=cf(-1.5,0.5,0)*euler(0,0,-0.5*i*n)
  598. LW.C1=cf(0,0.5,0)*euler(0,0,0)]]
  599.  
  600. wld1.C0=clerp(wld1.C0,euler(-0.2,0,0)*cf(3,-1,-0.2),.4)
  601. awld1.C0=clerp(awld1.C0,euler(-0.2,0,0)*cf(-3,-1,-0.2),.4)
  602. bwld1.C0=clerp(bwld1.C0,euler(0,0,0)*cf(2,-0.6,-2),.4)
  603. bwld7.C0=clerp(bwld7.C0,euler(0,0,0)*cf(0,-0.6,-2),.4)
  604. bwld13.C0=clerp(bwld13.C0,euler(0,0,0)*cf(-2,-0.6,-2),.4)
  605. bwld2.C0=clerp(bwld2.C0,euler(3.14,-2,1.57-0.4)*cf(0,0,0),.4)
  606. bwld8.C0=clerp(bwld8.C0,euler(3.14,-2,1.57)*cf(0,0,0),.4)
  607. bwld14.C0=clerp(bwld14.C0,euler(3.14,-2,1.57+0.4)*cf(0,0,0),.4)
  608. brefwld.C0=clerp(brefwld.C0,euler(0,0,0)*cf(0,-2,0),.4)
  609. n=n-0.1
  610. end
  611. --[[Torso.Neck.C0=necko*euler(0,0,0)
  612. RootJoint.C0=RootCF*euler(0,0,0)
  613. RW.C0=cf(1.5,0.5,0)*euler(0,0,0.5)
  614. RW.C1=cf(0,0.5,0)*euler(0,0,0)
  615. LW.C0=cf(-1.5,0.5,0)*euler(0,0,-0.5)
  616. LW.C1=cf(0,0.5,0)*euler(0,0,0)]]
  617. end
  618.  
  619. function AimRailGun()
  620. for i=0,1,0.1 do
  621. swait()
  622. LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(1.57,0,0),.4)
  623. end
  624. coroutine.resume(coroutine.create(function(Weld)
  625. while aimrailgun==true do
  626. wait()
  627. --[[local pos=Vector3.new(MMouse.Hit.p.x,MMouse.Hit.p.y,MMouse.Hit.p.z)
  628. offset=(RootPart.Position.y-MMouse.Hit.p.y)/60
  629. offset2=(RootPart.Position.x-MMouse.Hit.p.x)/60
  630. mag=(RootPart.Position-MMouse.Hit.p).magnitude/80
  631. offset=offset/mag
  632. offset2=offset2/mag ]]
  633. --[[cff=cf(prt2.CFrame.p,MMouse.Hit.p)
  634. local HitPos=cff.p
  635. local CJ=cf(HitPos)
  636. local C0=cff:inverse() *CJ
  637. local C1=prt2.CFrame:inverse() * CJ
  638. wld1.Part1=RootPart]]
  639. --[[Weld.C0=euler(0,0,0)*cf(3,-1,-0.2)
  640. wld2.C0=CFrame.Angles(math.asin(MMouse.Hit.p.x),math.rad(0),math.atan2(MMouse.Hit.p.z,MMouse.Hit.p.x))]]
  641. local mpos = prt1.CFrame*euler(0,0,0)--*CFrame.new(3,-1,-0.2) -- thx doogle <3
  642. local cff = CFrame.new(mpos.p,MMouse.Hit.p) * CFrame.Angles(math.pi/2,0,0)
  643. local x,y,z = prt1.CFrame:toObjectSpace(cff):toEulerAnglesXYZ()
  644. wld1.Part1=RailgunTarget
  645. wld1.C0=euler(0,0,0)*cf(3,-1,-0.2)
  646. wld2.Part0=prt1
  647. wld2.Part1=prt2
  648. wld2.C0=clerp(wld2.C0,CFrame.Angles(x,y,z)*euler(-1.57,0,0),.3)
  649. end
  650. end),wld1)
  651. end
  652.  
  653. function UnAimRailGun()
  654. for i=0,1,0.1 do
  655. swait()
  656. --LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-0.5),.4)
  657. --[[wld2.Part0=prt2
  658. wld2.Part1=prt1]]
  659. wld1.Part1=RailgunTarget.Parent.Torso
  660. wld1.C0=clerp(wld1.C0,euler(-0.2,0,0)*cf(3,-1,-0.2),.5)
  661. wld2.C0=clerp(wld2.C0,euler(0,0,0)*cf(0,0,0),.5)
  662. --wld1.C0=euler(-0.2,-0.3,0)*cf(3,-1,-0.2)
  663. end
  664. attack=false
  665. end
  666.  
  667. function AimCannon()
  668. for i=0,1,0.1 do
  669. swait()
  670. RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1.57,0,0),.4)
  671. end
  672. coroutine.resume(coroutine.create(function(Weld)
  673. while aimcannon==true do
  674. wait()
  675. --[[local pos=Vector3.new(MMouse.Hit.p.x,MMouse.Hit.p.y,MMouse.Hit.p.z)
  676. offset=(RootPart.Position.y-MMouse.Hit.p.y)/60
  677. offset2=(RootPart.Position.x-MMouse.Hit.p.x)/60
  678. mag=(RootPart.Position-MMouse.Hit.p).magnitude/80
  679. offset=offset/mag
  680. offset2=offset2/mag ]]
  681. --[[cff=cf(prt2.CFrame.p,MMouse.Hit.p)
  682. local HitPos=cff.p
  683. local CJ=cf(HitPos)
  684. local C0=cff:inverse() *CJ
  685. local C1=prt2.CFrame:inverse() * CJ
  686. wld1.Part1=RootPart]]
  687. --[[Weld.C0=euler(0,0,0)*cf(3,-1,-0.2)
  688. wld2.C0=CFrame.Angles(math.asin(MMouse.Hit.p.x),math.rad(0),math.atan2(MMouse.Hit.p.z,MMouse.Hit.p.x))]]
  689. local mpos = aprt1.CFrame*euler(0,0,0)--*CFrame.new(3,-1,-0.2) -- thx doogle <3
  690. local cff = CFrame.new(mpos.p,MMouse.Hit.p) * CFrame.Angles(math.pi/2,0,0)
  691. local x,y,z = aprt1.CFrame:toObjectSpace(cff):toEulerAnglesXYZ()
  692. awld1.Part1=CannonTarget
  693. awld1.C0=euler(0,0,0)*cf(-3,-1,-0.2)
  694. awld2.Part0=aprt1
  695. awld2.Part1=aprt2
  696. awld2.C0=clerp(awld2.C0,CFrame.Angles(x,y,z)*euler(-1.57,0,0),.3)
  697. end
  698. end),wld1)
  699. end
  700.  
  701. function UnAimCannon()
  702. for i=0,1,0.1 do
  703. swait()
  704. --RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(0,0,0.5),.4)
  705. --[[awld2.Part0=aprt2
  706. awld2.Part1=aprt1]]
  707. awld1.Part1=CannonTarget.Parent.Torso
  708. awld1.C0=clerp(awld1.C0,euler(-0.2,0,0)*cf(-3,-1,-0.2),.5)
  709. awld2.C0=clerp(awld2.C0,euler(0,0,0)*cf(0,0,0),.5)
  710. --awld1.C0=euler(-0.2,0.3,0)*cf(-3,-1,-0.2)
  711. end
  712. end
  713.  
  714. function ShootRailGun()
  715. so(Asset.."169380505",prt8,.5,1)
  716. local MouseLook=cf((prt8.Position+MMouse.Hit.p)/2,MMouse.Hit.p)
  717. local hit,pos = rayCast(prt8.Position,MouseLook.lookVector,999,RailgunTarget.Parent)
  718. local mag=(prt8.Position-pos).magnitude
  719. MagicCylinder(BrickColor.new("Cyan"),CFrame.new((prt8.Position+pos)/2,pos)*angles(1.57,0,0),1,mag*5,1,1.2,0,1.2,0.05)
  720. if hit~=nil then
  721. ref=part(3,workspace,0,1,Color3,"Reference",vt())
  722. ref.Anchored=true
  723. ref.CFrame=cf(pos)
  724. game:GetService("Debris"):AddItem(ref,1)
  725. so(Asset.."153092334",ref,.5,1.5)
  726. so(Asset.."169380505",ref,.5,1.5)
  727. MagicCircle(BrickColor.new("Cyan"),cf(pos),10,10,10,1,1,1,0.05)
  728. Damagefunc(hit,10,15,0,"Normal",RootPart,0)
  729. end
  730. end
  731.  
  732. function ShootCannon()
  733. so(Asset.."161006069",hit,.5,1)
  734. local MainPos=aprt8.Position
  735. local MainPos2=MMouse.Hit.p
  736. local MouseLook=cf((MainPos+MainPos2)/2,MainPos2)
  737. --[[local mag=(MainPos-pos).magnitude
  738. MagicCylinder(BrickColor.new("Bright blue"),CFrame.new((MainPos+pos)/2,pos)*angles(1.57,0,0),1,mag*5,1,0.5,0,0.5,0.05)]]
  739. num=30
  740. coroutine.resume(coroutine.create(function()
  741. repeat
  742. wait()
  743. local hit,pos = rayCast(MainPos,MouseLook.lookVector,10,CannonTarget.Parent)
  744. local mag=(MainPos-pos).magnitude
  745. MagicCylinder(BrickColor.new("Bright blue"),CFrame.new((MainPos+pos)/2,pos)*angles(1.57,0,0),3,mag*5,3,1.5,0,1.5,0.01)
  746. MainPos=MainPos+(MouseLook.lookVector*10)
  747. num=num-1
  748. if hit~=nil then
  749. num=0
  750. Damagefunc(hit,20,30,0,"Normal",RootPart,.2)
  751. ref=part(3,workspace,0,1,Color3,"Reference",vt())
  752. ref.Anchored=true
  753. ref.CFrame=cf(pos)
  754. so(Asset.."169445602",ref,1,0.8)
  755. so(Asset.."153092334",ref,1,0.8)
  756. MagicBlock(BrickColor.new("Bright blue"),cf(pos),20,20,20,10,10,10,0.05)
  757. game:GetService("Debris"):AddItem(ref,1)
  758. MagniDamage(ref,10,10,20,0,"Normal")
  759. end
  760. until num<=0
  761. end))
  762. end
  763.  
  764. function ChangeTargetPose()
  765. for i=0,1,0.05 do
  766. swait()
  767. wld1.C0=clerp(wld1.C0,euler(-0.2,0,-0.3)*cf(4,-1,-0.2),.4)
  768. awld1.C0=clerp(awld1.C0,euler(-0.2,0,0.3)*cf(-4,-1,-0.2),.4)
  769. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.2,0,0),.3)
  770. RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(0,0,1.57),.3)
  771. LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-1.57),.3)
  772. end
  773. end
  774.  
  775. function ChangeRailgunTarget()
  776. Targ=MMouse.Target
  777. print(Targ)
  778. if Targ~=nil and Targ.Parent:findFirstChild("Humanoid")~=nil and Targ.Parent:findFirstChild("Torso")~=nil and Targ.Parent:findFirstChild("HumanoidRootPart")~=nil then
  779. RailgunTarget=Targ.Parent.HumanoidRootPart
  780. wld1.Part1=RailgunTarget.Parent.Torso
  781. end
  782. end
  783.  
  784. function ChangeCannonTarget()
  785. Targ=MMouse.Target
  786. if Targ~=nil and Targ.Parent:findFirstChild("Humanoid")~=nil and Targ.Parent:findFirstChild("Torso")~=nil and Targ.Parent:findFirstChild("HumanoidRootPart")~=nil then
  787. CannonTarget=Targ.Parent.HumanoidRootPart
  788. awld1.Part1=CannonTarget.Parent.Torso
  789. end
  790. end
  791.  
  792. function BackToMe()
  793. model1.Parent=Character
  794. model2.Parent=Character
  795. for i=1,#Railgun do
  796. Railgun[i].Parent=model1
  797. RailgunWelds[i].Parent=Railgun[1]
  798. end
  799. for i=1,#Plasma do
  800. Plasma[i].Parent=model2
  801. PlasmaWelds[i].Parent=Plasma[1]
  802. end
  803. RailgunTarget=RootPart
  804. CannonTarget=RootPart
  805. wld1.Part1=RailgunTarget.Parent.Torso
  806. awld1.Part1=CannonTarget.Parent.Torso
  807. end
  808.  
  809. function attackone()
  810. attack=true bladeattack=true
  811. for i=0,1,0.1 do
  812. swait()
  813. brefwld.C0=clerp(brefwld.C0,euler(0,0,0)*cf(0,-2.5,2),.4)
  814. bwld1.C0=clerp(bwld1.C0,euler(0,0,0)*cf(3,-0.6,-2),.4)
  815. bwld7.C0=clerp(bwld7.C0,euler(0,0,0)*cf(0,-0.6,-2),.4)
  816. bwld13.C0=clerp(bwld13.C0,euler(0,0,0)*cf(-3,-0.6,-2),.4)
  817. bwld2.C0=clerp(bwld2.C0,euler(3.14,-1.5,1)*cf(0,0,0),.4)
  818. bwld8.C0=clerp(bwld8.C0,euler(3.14,-1.5,1.57)*cf(0,0,0),.4)
  819. bwld14.C0=clerp(bwld14.C0,euler(3.14,-1.5,2)*cf(0,0,0),.4)
  820. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.3,0,0),.4)
  821. RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(3,0,-0.2),.4)
  822. LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(3,0,0.2),.4)
  823. end
  824. for i=0,1,0.2 do
  825. swait()
  826. brefwld.C0=clerp(brefwld.C0,euler(1.57,0,0)*cf(0,1.5,3),i)
  827. bwld2.C0=clerp(bwld2.C0,euler(3.14,-1.5,1.57)*cf(0,0,0),i)
  828. bwld8.C0=clerp(bwld8.C0,euler(3.14,-1.5,1.57)*cf(0,0,0),i)
  829. bwld14.C0=clerp(bwld14.C0,euler(3.14,-1.5,1.57)*cf(0,0,0),i)
  830. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.3,0,0),i)
  831. RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(1,0,0.2),i)
  832. LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(1,0,-0.2),i)
  833. end
  834. for i=0,1,0.1 do
  835. swait()
  836. brefwld.C0=clerp(brefwld.C0,euler(1.7,0,0)*cf(0,2,3),.3)
  837. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0.4,0,0),.3)
  838. RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(.5,0,0.2),.3)
  839. LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(.5,0,-0.2),.3)
  840. end
  841. attack=false bladeattack=false
  842. --equipanim()
  843. end
  844.  
  845. function MagniDamage(Part,magni,mindam,maxdam,knock,Type)
  846. for _,c in pairs(workspace:children()) do
  847. local hum=c:findFirstChild("Humanoid")
  848. if hum~=nil then
  849. local head=c:findFirstChild("Torso")
  850. if head~=nil then
  851. local targ=head.Position-Part.Position
  852. local mag=targ.magnitude
  853. if mag<=magni and c.Name~=Player.Name then
  854. if c~=CannonTarget.Parent or c~=RailgunTarget.Parent then
  855. Damagefunc(head,mindam,maxdam,knock,Type,RootPart,.2,1,nil,1)
  856. end
  857. end
  858. end
  859. end
  860. end
  861. end
  862.  
  863. function rayCast(Pos, Dir, Max, Ignore) -- Origin Position , Direction, MaxDistance , IgnoreDescendants
  864. return game:service("Workspace"):FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore)
  865. end
  866.  
  867. local Point=Torso.CFrame*cf(0,Torso.Size.Y,0)
  868. LastPoint=Point
  869. function effect(Color,Ref,LP,P1,returnn)
  870. local effectsmsh=Instance.new("CylinderMesh")
  871. effectsmsh.Scale=Vector3.new(0.2,1,0.2)
  872. effectsmsh.Name="Mesh"
  873. local effectsg=Instance.new("Part")
  874. effectsg.formFactor=3
  875. effectsg.CanCollide=false
  876. effectsg.Name="Eff"
  877. effectsg.Locked=true
  878. effectsg.Anchored=true
  879. effectsg.Size=Vector3.new(0.5,1,0.5)
  880. effectsg.Parent=workspace
  881. effectsmsh.Parent=effectsg
  882. effectsg.BrickColor=BrickColor.new(Color)
  883. effectsg.Reflectance=Ref
  884. local point1=P1
  885. local mg=(LP.p - point1.p).magnitude
  886. effectsg.Size=Vector3.new(0.5,mg,0.5)
  887. effectsg.CFrame=cf((LP.p+point1.p)/2,point1.p) * CFrame.Angles(math.rad(90),0,0)
  888. effectsmsh.Scale=Vector3.new(0.2,1,0.2)
  889. game:GetService("Debris"):AddItem(effectsg,2)
  890. if returnn then return effectsg end
  891. coroutine.resume(coroutine.create(function(Part,Mesh)
  892. if not returnn then
  893. for i=0,1,0.05 do
  894. wait()
  895. Part.Transparency=1*i
  896. Mesh.Scale=Vector3.new(0.5-0.5*i,1,0.5-0.5*i)
  897. end
  898. Part.Parent=nil
  899. end
  900. end),effectsg,effectsmsh)
  901. end
  902.  
  903. --[[
  904. Things for effects
  905. put the variables in one table
  906. like effect={brick,interval,i}
  907. ]]
  908. local Effects={}
  909. function MagicBlock(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
  910. local prt=part(3,workspace,0,0,brickcolor,"Effect",vt())
  911. prt.Anchored=true
  912. prt.CFrame=cframe
  913. msh=mesh("BlockMesh",prt,"","",vt(0,0,0),vt(x1,y1,z1))
  914. game:GetService("Debris"):AddItem(prt,5)
  915. table.insert(Effects,{prt,"Block1",delay,x3,y3,z3}) --part, type, delay
  916. --[[coroutine.resume(coroutine.create(function(Part,Mesh,dur)
  917. for i=0,1,delay do
  918. wait()
  919. Part.CFrame=Part.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50))
  920. Part.Transparency=i
  921. Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
  922. end
  923. Part.Parent=nil
  924. end),prt,msh)]]
  925. end
  926.  
  927. function MagicCircle(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
  928. local prt=part(3,workspace,0,0,brickcolor,"Effect",vt())
  929. prt.Anchored=true
  930. prt.CFrame=cframe
  931. local msh=mesh("SpecialMesh",prt,"Sphere","",vt(0,0,0),vt(x1,y1,z1))
  932. game:GetService("Debris"):AddItem(prt,5)
  933. table.insert(Effects,{prt,"Cylinder",delay,x3,y3,z3})
  934. coroutine.resume(coroutine.create(function(Part,Mesh)
  935. local wld=nil
  936. for i=0,1,delay do
  937. wait()
  938. Part.CFrame=Part.CFrame
  939. Part.Transparency=i
  940. Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
  941. end
  942. Part.Parent=nil
  943. end),prt,msh)
  944. end
  945.  
  946. function MagicRing(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay,Type,parent)
  947. local prt=part(3,workspace,0,0,brickcolor,"Effect",vt())
  948. if Type~=2 then
  949. prt.Anchored=true
  950. end
  951. prt.CFrame=cframe
  952. local msh=mesh("SpecialMesh",prt,"FileMesh","http://www.roblox.com/asset/?id=3270017",vt(0,0,0),vt(x1,y1,z1))
  953. game:GetService("Debris"):AddItem(prt,5)
  954. coroutine.resume(coroutine.create(function(Part,Mesh,dur)
  955. local wld=nil
  956. if dur==2 then
  957. wld=weld(Part,Part,parent,euler(0,0,0)*cf(0,0,0))
  958. end
  959. for i=0,1,delay do
  960. wait()
  961. if dur==1 then
  962. Part.CFrame=Part.CFrame
  963. elseif dur==2 then
  964. wld.C0=cframe
  965. end
  966. Part.Transparency=i
  967. Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
  968. end
  969. Part.Parent=nil
  970. end),prt,msh,Type)
  971. end
  972.  
  973. function MagicWaveThing(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
  974. local prt=part(3,workspace,0,0,brickcolor,"Effect",vt())
  975. prt.Anchored=true
  976. prt.CFrame=cframe
  977. msh=mesh("SpecialMesh",prt,"FileMesh","http://www.roblox.com/asset/?id=1051557",vt(0,0,0),vt(x1,y1,z1))
  978. game:GetService("Debris"):AddItem(prt,5)
  979. coroutine.resume(coroutine.create(function(Part,Mesh)
  980. for i=0,1,delay do
  981. wait()
  982. Part.CFrame=Part.CFrame*euler(0,0.7,0)
  983. Part.Transparency=i
  984. Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
  985. end
  986. Part.Parent=nil
  987. end),prt,msh)
  988. end
  989.  
  990. function WaveEffect(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay,mshtype)
  991. local prt=part(3,workspace,0,0,brickcolor,"Effect",vt())
  992. prt.Anchored=true
  993. prt.CFrame=cframe
  994. local thetype=""
  995. if mshtype==1 then
  996. thetype="http://www.roblox.com/asset/?id=20329976"
  997. elseif mshtype==2 then
  998. thetype="http://www.roblox.com/asset/?id=1323306"
  999. end
  1000. msh=mesh("SpecialMesh",prt,"FileMesh",thetype,vt(0,0,0),vt(x1,y1,z1))
  1001. game:GetService("Debris"):AddItem(prt,2)
  1002. coroutine.resume(coroutine.create(function(Part,Mesh)
  1003. for i=0,1,delay do
  1004. wait()
  1005. Part.CFrame=Part.CFrame*cf(0,y3/2,0)
  1006. Part.Transparency=i
  1007. Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
  1008. end
  1009. Part.Parent=nil
  1010. end),prt,msh)
  1011. end
  1012.  
  1013. function MagicCylinder(brickcolor,cframe,x1,y1,z1,x3,y3,z3,delay)
  1014. local prt=part(3,Character,0,0,brickcolor,"Effect",vt(0.2,0.2,0.2))
  1015. prt.Anchored=true
  1016. prt.CFrame=cframe
  1017. msh=mesh("SpecialMesh",prt,"Head","",vt(0,0,0),vt(x1,y1,z1))
  1018. game:GetService("Debris"):AddItem(prt,5)
  1019. --table.insert(Effects,{prt,"Cylinder",delay,x3,y3,z3})
  1020. Effects[#Effects+1]={prt,"Cylinder",delay,x3,y3,z3} --part, type, delay
  1021. --[[coroutine.resume(coroutine.create(function(Part,Mesh)
  1022. for i=0,1,delay do
  1023. wait()
  1024. Part.CFrame=Part.CFrame
  1025. Part.Transparency=i
  1026. Mesh.Scale=Mesh.Scale+vt(x3,y3,z3)
  1027. end
  1028. Part.Parent=nil
  1029. end),prt,msh)]]
  1030. end
  1031.  
  1032. Damagefunc=function(hit,minim,maxim,knockback,Type,Property,Delay,KnockbackType,decreaseblock)
  1033. if hit.Parent==nil then
  1034. return
  1035. end
  1036. h=hit.Parent:FindFirstChild("Humanoid")
  1037. for _,v in pairs(hit.Parent:children()) do
  1038. if v:IsA("Humanoid") then
  1039. h=v
  1040. end
  1041. end
  1042. if hit.Parent.Parent:FindFirstChild("Torso")~=nil then
  1043. h=hit.Parent.Parent:FindFirstChild("Humanoid")
  1044. end
  1045. if hit.Parent.className=="Hat" then
  1046. hit=hit.Parent.Parent:findFirstChild("Head")
  1047. end
  1048. -- and hit.Parent~=CannonTarget.Parent or hit.Parent~=RailgunTarget.Parent
  1049. if h~=nil and hit.Parent.Name~=Character.Name and hit.Parent:FindFirstChild("Torso")~=nil then
  1050. if hit.Parent~=CannonTarget.Parent and hit.Parent~=RailgunTarget.Parent then
  1051. if hit.Parent:findFirstChild("DebounceHit")~=nil then if hit.Parent.DebounceHit.Value==true then return end end
  1052. --[[ if game.Players:GetPlayerFromCharacter(hit.Parent)~=nil then
  1053. return
  1054. end]]
  1055. -- hs(hit,1.2)
  1056. c=Instance.new("ObjectValue")
  1057. c.Name="creator"
  1058. c.Value=game:service("Players").LocalPlayer
  1059. c.Parent=h
  1060. game:GetService("Debris"):AddItem(c,.5)
  1061. Damage=math.random(minim,maxim)
  1062. -- h:TakeDamage(Damage)
  1063. blocked=false
  1064. block=hit.Parent:findFirstChild("Block")
  1065. if block~=nil then
  1066. print(block.className)
  1067. if block.className=="NumberValue" then
  1068. if block.Value>0 then
  1069. blocked=true
  1070. if decreaseblock==nil then
  1071. block.Value=block.Value-1
  1072. end
  1073. end
  1074. end
  1075. if block.className=="IntValue" then
  1076. if block.Value>0 then
  1077. blocked=true
  1078. if decreaseblock~=nil then
  1079. block.Value=block.Value-1
  1080. end
  1081. end
  1082. end
  1083. end
  1084. if blocked==false then
  1085. -- h:TakeDamage(Damage)
  1086. h.Health=h.Health-Damage
  1087. showDamage(hit.Parent,Damage,.5,BrickColor:Red())
  1088. else
  1089. h.Health=h.Health-(Damage/2)
  1090. showDamage(hit.Parent,Damage/2,.5,BrickColor.new("Bright blue"))
  1091. end
  1092. if Type=="Knockdown" then
  1093. hum=hit.Parent.Humanoid
  1094. hum.PlatformStand=true
  1095. coroutine.resume(coroutine.create(function(HHumanoid)
  1096. swait(1)
  1097. HHumanoid.PlatformStand=false
  1098. end),hum)
  1099. local angle=(hit.Position-(Property.Position+Vector3.new(0,0,0))).unit
  1100. --hit.CFrame=cf(hit.Position,Vector3.new(angle.x,hit.Position.y,angle.z))*CFrame.fromEulerAnglesXYZ(math.pi/4,0,0)
  1101. local bodvol=Instance.new("BodyVelocity")
  1102. bodvol.velocity=angle*knockback
  1103. bodvol.P=5000
  1104. bodvol.maxForce=Vector3.new(8e+003, 8e+003, 8e+003)
  1105. bodvol.Parent=hit
  1106. rl=Instance.new("BodyAngularVelocity")
  1107. rl.P=3000
  1108. rl.maxTorque=Vector3.new(500000,500000,500000)*50000000000000
  1109. rl.angularvelocity=Vector3.new(math.random(-10,10),math.random(-10,10),math.random(-10,10))
  1110. rl.Parent=hit
  1111. game:GetService("Debris"):AddItem(bodvol,.5)
  1112. game:GetService("Debris"):AddItem(rl,.5)
  1113. elseif Type=="Normal" then
  1114. vp=Instance.new("BodyVelocity")
  1115. vp.P=500
  1116. vp.maxForce=Vector3.new(math.huge,0,math.huge)
  1117. -- vp.velocity=Character.Torso.CFrame.lookVector*Knockback
  1118. if KnockbackType==1 then
  1119. vp.velocity=Property.CFrame.lookVector*knockback+Property.Velocity/1.05
  1120. elseif KnockbackType==2 then
  1121. vp.velocity=Property.CFrame.lookVector*knockback
  1122. end
  1123. if knockback>0 then
  1124. vp.Parent=hit.Parent.Torso
  1125. end
  1126. game:GetService("Debris"):AddItem(vp,.5)
  1127. elseif Type=="Up" then
  1128. local bodyVelocity=Instance.new("BodyVelocity")
  1129. bodyVelocity.velocity=vt(0,30,0)
  1130. bodyVelocity.P=5000
  1131. bodyVelocity.maxForce=Vector3.new(8e+003, 8e+003, 8e+003)
  1132. bodyVelocity.Parent=hit
  1133. game:GetService("Debris"):AddItem(bodyVelocity,1)
  1134. rl=Instance.new("BodyAngularVelocity")
  1135. rl.P=3000
  1136. rl.maxTorque=Vector3.new(500000,500000,500000)*50000000000000
  1137. rl.angularvelocity=Vector3.new(math.random(-5,5),math.random(-5,5),math.random(-5,5))
  1138. rl.Parent=hit
  1139. game:GetService("Debris"):AddItem(rl,.5)
  1140. elseif Type=="Snare" then
  1141. bp=Instance.new("BodyPosition")
  1142. bp.P=2000
  1143. bp.D=100
  1144. bp.maxForce=Vector3.new(math.huge,math.huge,math.huge)
  1145. bp.position=hit.Parent.Torso.Position
  1146. bp.Parent=hit.Parent.Torso
  1147. game:GetService("Debris"):AddItem(bp,1)
  1148. elseif Type=="Charge" then
  1149. Charge=Charge+1
  1150. coroutine.resume(coroutine.create(function(Part)
  1151. swait(30)
  1152. for i=1,5 do
  1153. swait(5)
  1154. so("rbxasset://sounds\\unsheath.wav",hit,1,2)
  1155. MagicCircle(BrickColor.new("Bright red"),hit.CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50)),.2,2,.1,.2,8,.1,0.05)
  1156. newdam=math.random(1,5)
  1157. if blocked==false then
  1158. h:TakeDamage(newdam)
  1159. showDamage(hit.Parent,newdam,.5,BrickColor:Red())
  1160. else
  1161. h:TakeDamage(newdam/2)
  1162. showDamage(hit.Parent,newdam,.5,BrickColor.new("Bright blue"))
  1163. end
  1164. end
  1165. end),hit)
  1166. end
  1167. debounce=Instance.new("BoolValue")
  1168. debounce.Name="DebounceHit"
  1169. debounce.Parent=hit.Parent
  1170. debounce.Value=true
  1171. game:GetService("Debris"):AddItem(debounce,Delay)
  1172. c=Instance.new("ObjectValue")
  1173. c.Name="creator"
  1174. c.Value=Player
  1175. c.Parent=h
  1176. game:GetService("Debris"):AddItem(c,.5)
  1177. CRIT=false
  1178. hitDeb=true
  1179. AttackPos=6
  1180. end
  1181. end
  1182. end
  1183.  
  1184. showDamage=function(Char,Dealt,du,Color)
  1185. m=Instance.new("Model")
  1186. m.Name=tostring(Dealt)
  1187. h=Instance.new("Humanoid")
  1188. h.Health=0
  1189. h.MaxHealth=0
  1190. h.Parent=m
  1191. c=Instance.new("Part")
  1192. c.Transparency=0
  1193. c.BrickColor=Color
  1194. c.Name="Head"
  1195. c.TopSurface=0
  1196. c.BottomSurface=0
  1197. c.formFactor="Plate"
  1198. c.Size=Vector3.new(1,.4,1)
  1199. ms=Instance.new("CylinderMesh")
  1200. ms.Scale=Vector3.new(.8,.8,.8)
  1201. if CRIT==true then
  1202. ms.Scale=Vector3.new(1,1.25,1)
  1203. end
  1204. ms.Parent=c
  1205. c.Reflectance=0
  1206. Instance.new("BodyGyro").Parent=c
  1207. c.Parent=m
  1208. if Char:findFirstChild("Head")~=nil then
  1209. c.CFrame=cf(Char["Head"].CFrame.p+Vector3.new(0,1.5,0))
  1210. elseif Char.Parent:findFirstChild("Head")~=nil then
  1211. c.CFrame=cf(Char.Parent["Head"].CFrame.p+Vector3.new(0,1.5,0))
  1212. end
  1213. f=Instance.new("BodyPosition")
  1214. f.P=2000
  1215. f.D=100
  1216. f.maxForce=Vector3.new(math.huge,math.huge,math.huge)
  1217. f.position=c.Position+Vector3.new(0,3,0)
  1218. f.Parent=c
  1219. game:GetService("Debris"):AddItem(m,.5+du)
  1220. c.CanCollide=false
  1221. m.Parent=workspace
  1222. c.CanCollide=false
  1223. end
  1224.  
  1225. combo=0
  1226. local hold=false
  1227. local railgunshoot=true
  1228. local cannonshoot=true
  1229. function ob1d(mouse)
  1230. hold=true
  1231. if attack==true then return end
  1232. coroutine.resume(coroutine.create(function()
  1233. while hold==true do
  1234. wait()
  1235. if aimrailgun==true and railgunshoot==true then
  1236. railgunshoot=false
  1237. coroutine.resume(coroutine.create(function()
  1238. wait(.8)
  1239. railgunshoot=true
  1240. end))
  1241. ShootRailGun()
  1242. end
  1243. if aimcannon==true and cannonshoot==true then
  1244. cannonshoot=false
  1245. coroutine.resume(coroutine.create(function()
  1246. wait(2.1)
  1247. cannonshoot=true
  1248. end))
  1249. ShootCannon()
  1250. end
  1251. end
  1252. end))
  1253. if aimrailgun==true or aimcannon==true then return end
  1254. if bladeattack==true then return end
  1255. anum=math.random(1,1)
  1256. if anum==1 then
  1257. attackone()
  1258. end
  1259. end
  1260.  
  1261. function ob1u(mouse)
  1262. hold = false
  1263. end
  1264.  
  1265. buttonhold = false
  1266.  
  1267. eul=0
  1268. holdx=false
  1269. equipped=false
  1270. function key(key)
  1271. if key=="g" and aimrailgun==false and aimcannon==false and equipped==true then
  1272. if changetarget==false then
  1273. attack=true
  1274. changetarget=true
  1275. ChangeTargetPose()
  1276. else
  1277. attack=false
  1278. changetarget=false
  1279. for i=0,1,0.05 do
  1280. swait()
  1281. wld1.C0=clerp(wld1.C0,euler(-0.2,0,0)*cf(3,-1,-0.2),.4)
  1282. awld1.C0=clerp(awld1.C0,euler(-0.2,0,0)*cf(-3,-1,-0.2),.4)
  1283. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0),.3)
  1284. --[[RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(0,0,0.5),.3)
  1285. LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-0.5),.3)]]
  1286. --[[Torso.Neck.C0=necko*euler(0,0,0)
  1287. RootJoint.C0=RootCF*euler(0,0,0)
  1288. RW.C0=cf(1.5,0.5,0)*euler(0,0,0.5)
  1289. RW.C1=cf(0,0.5,0)*euler(0,0,0)
  1290. LW.C0=cf(-1.5,0.5,0)*euler(0,0,-0.5)
  1291. LW.C1=cf(0,0.5,0)*euler(0,0,0)]]
  1292. end
  1293. end
  1294. end
  1295. if changetarget==true and aimrailgun==false and aimcannon==false then
  1296. if key=="z" then
  1297. ChangeRailgunTarget()
  1298. end
  1299. if key=="x" then
  1300. ChangeCannonTarget()
  1301. end
  1302. if key=="c" then
  1303. BackToMe()
  1304. end
  1305. end
  1306. if attack==true then return end
  1307. if key=="f" then
  1308. attack=true
  1309. if equipped==false then
  1310. equipped=true
  1311. RSH=ch.Torso["Right Shoulder"]
  1312. LSH=ch.Torso["Left Shoulder"]
  1313. --
  1314. RSH.Parent=nil
  1315. LSH.Parent=nil
  1316. --
  1317. RW.Name="Right Shoulder"
  1318. RW.Part0=ch.Torso
  1319. RW.C0=cf(1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5)
  1320. RW.C1=cf(0, 0.5, 0)
  1321. RW.Part1=ch["Right Arm"]
  1322. RW.Parent=ch.Torso
  1323. --
  1324. LW.Name="Left Shoulder"
  1325. LW.Part0=ch.Torso
  1326. LW.C0=cf(-1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)
  1327. LW.C1=cf(0, 0.5, 0)
  1328. LW.Part1=ch["Left Arm"]
  1329. LW.Parent=ch.Torso
  1330. --
  1331. equipanim()
  1332. else
  1333. changetarget=false
  1334. equipped=false
  1335. hideanim()
  1336. swait(0)
  1337. RW.Parent=nil
  1338. LW.Parent=nil
  1339. RSH.Parent=player.Character.Torso
  1340. LSH.Parent=player.Character.Torso
  1341. end
  1342. attack=false
  1343. end
  1344. if equipped==false then return end
  1345. if changetarget==true then return end
  1346. if key=="0" then
  1347. Humanoid.WalkSpeed=(16*1.5)
  1348. end
  1349. if key=="z" then
  1350. if aimrailgun==false then
  1351. aimrailgun=true
  1352. AimRailGun()
  1353. else
  1354. aimrailgun=false
  1355. UnAimRailGun()
  1356. end
  1357. end
  1358. if key=="x" then
  1359. if aimcannon==false then
  1360. aimcannon=true
  1361. AimCannon()
  1362. else
  1363. aimcannon=false
  1364. UnAimCannon()
  1365. end
  1366. end
  1367. end
  1368.  
  1369. function key2(key)
  1370. if key=="0" then
  1371. Humanoid.WalkSpeed=16
  1372. end
  1373. end
  1374.  
  1375. function s(mouse)
  1376. mouse.Button1Down:connect(function() ob1d(mouse) end)
  1377. mouse.Button1Up:connect(function() ob1u(mouse) end)
  1378. mouse.KeyDown:connect(key)
  1379. mouse.KeyUp:connect(key2)
  1380.  
  1381. player=Player
  1382. ch=Character
  1383. MMouse=mouse
  1384. end
  1385.  
  1386. function ds(mouse)
  1387. end
  1388.  
  1389. Bin.Selected:connect(s)
  1390. Bin.Deselected:connect(ds)
  1391. print("Vanguard Gauntlet loaded.")
  1392.  
  1393. local Anim="Idle"
  1394. local idleanim=0
  1395. local idleanim2=false
  1396. while true do
  1397. wait()
  1398. local torvel=(RootPart.Velocity*Vector3.new(1,0,1)).magnitude
  1399. if equipped==true then
  1400. if idleanim>=0.5 then
  1401. idleanim2=true
  1402. elseif idleanim<=0 then
  1403. idleanim2=false
  1404. end
  1405. if idleanim2==false then
  1406. idleanim=idleanim+0.005
  1407. else
  1408. idleanim=idleanim-0.005
  1409. end
  1410. if bladeattack==false then
  1411. brefwld.C0=clerp(brefwld.C0,euler(0,0,0)*cf(0,-2+idleanim,0),.4)
  1412. bwld1.C0=clerp(bwld1.C0,euler(0,0,0)*cf(2,-0.6,-2),.4)
  1413. bwld7.C0=clerp(bwld7.C0,euler(0,0,0)*cf(0,-0.6,-2),.4)
  1414. bwld13.C0=clerp(bwld13.C0,euler(0,0,0)*cf(-2,-0.6,-2),.4)
  1415. bwld2.C0=clerp(bwld2.C0,euler(3.14,-2-(idleanim/2),1.57-0.4)*cf(0,0,0),.4)
  1416. bwld8.C0=clerp(bwld8.C0,euler(3.14,-2-(idleanim/2),1.57)*cf(0,0,0),.4)
  1417. bwld14.C0=clerp(bwld14.C0,euler(3.14,-2-(idleanim/2),1.57+0.4)*cf(0,0,0),.4)
  1418. end
  1419. if torvel<1 then
  1420. Anim="Idle"
  1421. --idleanim=idleanim+0.005
  1422. --[[if idleanim>=0.5 then
  1423. idleanim=0
  1424. end]]
  1425. RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.4)
  1426. if changetarget==false and bladeattack==false then
  1427. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0),.4)
  1428. end
  1429. if aimcannon==false and attack==false then
  1430. RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(idleanim,0,0.5-idleanim),.4)
  1431. end
  1432. if aimrailgun==false and attack==false then
  1433. LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(idleanim,0,-0.5+idleanim),.4)
  1434. end
  1435. elseif torvel>2 and torvel<30 then
  1436. Anim="Walk"
  1437. RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0),.4)
  1438. if changetarget==false then
  1439. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(0,0,0),.4)
  1440. end
  1441. --RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0,0,0.5),.4)
  1442. if aimcannon==false and changetarget==false and bladeattack==false then
  1443. RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(-0.5,0,0),.4)
  1444. end
  1445. if aimrailgun==false and changetarget==false and bladeattack==false then
  1446. LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.5,0,0),.4)
  1447. end
  1448. elseif torvel>=22 then
  1449. Anim="Run"
  1450. --print("runnin'")
  1451. RootJoint.C0=clerp(RootJoint.C0,RootCF*euler(0.5,0,0),.4)
  1452. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*euler(-0.3,0,0),.4)
  1453. if aimcannon==false and changetarget==false and bladeattack==false then
  1454. RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(-1,0,0),.4)
  1455. end
  1456. if aimrailgun==false and changetarget==false and bladeattack==false then
  1457. LW.C0=clerp(LW.C0,cf(-1,0.5,-0.5)*euler(1.57,0,1),.4)
  1458. end
  1459. end
  1460. end
  1461. --[[if torvel<19 then
  1462. Anim="Walk"
  1463. coroutine.resume(coroutine.create(function()
  1464. for i=0,1,0.1 do
  1465. swait()
  1466. RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(-0.2,0,0),.4)
  1467. LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(-0.2,0,0),.4)
  1468. end
  1469. end))
  1470. elseif torvel<1 then
  1471. Anim="Idle"
  1472. coroutine.resume(coroutine.create(function()
  1473. for i=0,1,0.1 do
  1474. swait()
  1475. RW.C0=clerp(RW.C0,cf(1.5,0.5,0)*euler(0,0,0.5),.4)
  1476. LW.C0=clerp(LW.C0,cf(-1.5,0.5,0)*euler(0,0,-0.5),.4)
  1477. end
  1478. end))
  1479. end]]
  1480. --[[if equipped==true and bladeattack==false then
  1481. brefwld.C0=clerp(brefwld.C0,euler(0,0,circle)*cf(0,-2,-2),.4)
  1482. circle=circle-0.1
  1483. end]]
  1484. if #Effects>0 then
  1485. --table.insert(Effects,{prt,"Block1",delay})
  1486. for e=1,#Effects do
  1487. if Effects[e]~=nil then
  1488. --for j=1,#Effects[e] do
  1489. local Thing=Effects[e]
  1490. if Thing~=nil then
  1491. local Part=Thing[1]
  1492. local Mode=Thing[2]
  1493. local Delay=Thing[3]
  1494. local IncX=Thing[4]
  1495. local IncY=Thing[5]
  1496. local IncZ=Thing[6]
  1497. if Thing[3]<=1 then
  1498. if Thing[2]=="Block1" then
  1499. Thing[1].CFrame=Thing[1].CFrame*euler(math.random(-50,50),math.random(-50,50),math.random(-50,50))
  1500. Mesh=Thing[1].Mesh
  1501. Mesh.Scale=Mesh.Scale+vt(Thing[4],Thing[5],Thing[6])
  1502. Thing[1].Transparency=Thing[3]
  1503. Thing[3]=Thing[3]+Delay
  1504. elseif Thing[2]=="Cylinder" then
  1505. --local TheCF=Thing[1].CFrame
  1506. --Thing[1].CFrame=TheCF
  1507. Mesh=Thing[1].Mesh
  1508. Mesh.Scale=Mesh.Scale+vt(Thing[4],Thing[5],Thing[6])
  1509. Thing[1].Transparency=Thing[3]+Delay
  1510. Thing[3]=Thing[3]+Delay
  1511. end
  1512. else
  1513. Part.Parent=nil
  1514. table.remove(Effects,e)
  1515. end
  1516. end
  1517. --end
  1518. end
  1519. end
  1520. end
  1521. end
  1522. --[[
  1523. Copyrighted (C) Fenrier 2014
  1524. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement