Advertisement
pklo

Untitled

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