Advertisement
ScriptBuilderSHEHAB

VANGUARD GAUNTL

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