Advertisement
Dark_EccentricYT

Untitled

Nov 26th, 2020
1,289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.58 KB | None | 0 0
  1. function rand(a)return (math.random()-.5)*2*a end
  2. function q(f,arg)return coroutine.resume(coroutine.create(f),unpack(arg or {}))end
  3. function fade(p,s)q(function(part,start)for i=s,1,.05 do part.Transparency = part.Transparency+0.05 wait(1/30)end end,{p,s})end
  4. function appear(p)q(function(part)for i=1,0,-.05 do part.Transparency = part.Transparency-0.05 wait(1/30)end end,{p})end
  5. function Part(Name,Parent,Size,CFrame,Color,Trans,Anch,Can,Mat,Ref)
  6. local p = Instance.new("Part",Parent)p.Name = Name
  7. p.FormFactor = "Custom"p.Size = Size
  8. p.Anchored = Anch p.CFrame = CFrame
  9. p.BrickColor = BrickColor.new(Color)p.Transparency = Trans
  10. p.TopSurface = 0 p.CanCollide = Can
  11. p.BottomSurface = 0 p.Material = Mat
  12. p.Reflectance = Ref or 0;p:BreakJoints()
  13. p.Locked = true;return p
  14. end
  15. function WedgePart(Name,Parent,Size,CFrame,Color,Trans,Anch,Can,Mat,Ref)
  16. local p = Instance.new("WedgePart",Parent)p.Name = Name
  17. p.FormFactor = "Custom"p.Size = Size
  18. p.Anchored = Anch p.CFrame = CFrame
  19. p.BrickColor = BrickColor.new(Color)p.Transparency = Trans
  20. p.TopSurface = 0 p.CanCollide = Can
  21. p.BottomSurface = 0 p.Material = Mat
  22. p.Reflectance = Ref or 0;p:BreakJoints()
  23. p.Locked = true;return p
  24. end
  25. function Mesh(Parent,Type,Scale,ID,TID)
  26. local m = Instance.new("SpecialMesh",Parent)m.MeshType = Type
  27. m.Scale = Scale or Vector3.new(1,1,1)
  28. if ID then m.MeshId = ID end if TID then m.TextureId = TID end
  29. return m
  30. end
  31. function Weld(p1,p2,c0,c1)
  32. local w = Instance.new("Weld",p1)w.Part0 = p1;w.Part1 = p2
  33. w.C0,w.C1 = c0 or CFrame.new(),c1 or CFrame.new()
  34. return w
  35. end
  36. function lerp(a,b,c)
  37. return a+(b-a)*c
  38. end
  39. do
  40. local function QuaternionFromCFrame(cf)
  41. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  42. local trace = m00 + m11 + m22
  43. if trace > 0 then
  44. local s = math.sqrt(1 + trace)
  45. local recip = 0.5/s
  46. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  47. else
  48. local i = 0
  49. if m11 > m00 then
  50. i = 1
  51. end
  52. if m22 > (i == 0 and m00 or m11) then
  53. i = 2
  54. end
  55. if i == 0 then
  56. local s = math.sqrt(m00-m11-m22+1)
  57. local recip = 0.5/s
  58. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  59. elseif i == 1 then
  60. local s = math.sqrt(m11-m22-m00+1)
  61. local recip = 0.5/s
  62. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  63. elseif i == 2 then
  64. local s = math.sqrt(m22-m00-m11+1)
  65. local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  66. end
  67. end
  68. end
  69. local function QuaternionToCFrame(px, py, pz, x, y, z, w)
  70. local xs, ys, zs = x + x, y + y, z + z
  71. local wx, wy, wz = w*xs, w*ys, w*zs
  72. local xx = x*xs
  73. local xy = x*ys
  74. local xz = x*zs
  75. local yy = y*ys
  76. local yz = y*zs
  77. local zz = z*zs
  78. 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))
  79. end
  80. local function QuaternionSlerp(a, b, t)
  81. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  82. local startInterp, finishInterp;
  83. if cosTheta >= 0.0001 then
  84. if (1 - cosTheta) > 0.0001 then
  85. local theta = math.acos(cosTheta)
  86. local invSinTheta = 1/math.sin(theta)
  87. startInterp = math.sin((1-t)*theta)*invSinTheta
  88. finishInterp = math.sin(t*theta)*invSinTheta
  89. else
  90. startInterp = 1-t
  91. finishInterp = t
  92. end
  93. else
  94. if (1+cosTheta) > 0.0001 then
  95. local theta = math.acos(-cosTheta)
  96. local invSinTheta = 1/math.sin(theta)
  97. startInterp = math.sin((t-1)*theta)*invSinTheta
  98. finishInterp = math.sin(t*theta)*invSinTheta
  99. else
  100. startInterp = t-1
  101. finishInterp = t
  102. end
  103. end
  104. 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
  105. end
  106. function clerp(a,b,t)
  107. local qa = {QuaternionFromCFrame(a)}
  108. local qb = {QuaternionFromCFrame(b)}
  109. local ax, ay, az = a.x, a.y, a.z
  110. local bx, by, bz = b.x, b.y, b.z
  111. local _t = 1-t
  112. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  113. end
  114. end
  115. ---------------------------------------------
  116. player = game:service("Players").LocalPlayer
  117. local char
  118. repeat wait() char = player.Character until char
  119. root = char:WaitForChild("HumanoidRootPart")
  120. torso = char:WaitForChild("Torso")
  121. humanoid = char:WaitForChild("Humanoid")
  122. rarm = char:WaitForChild("Right Arm")
  123. mouse = player:GetMouse()
  124. step = game:service("RunService").Stepped
  125. Mode = ""
  126. LastMode = ""
  127. asset = "http://www.roblox.com/asset/?id="
  128. meshes = {["blast"] = 20329976,["ring"] = 3270017,["spike"] = 1033714,["cone"] = 1082802,["crown"] = 20329976,["cloud"] = 1095708,["diamond"] = 9756362}
  129. sounds = {["gun"] = 131070686;}
  130. mcolor = "Lime green"--"Deep orange"--"Dark Royal blue"--"Toothpaste"--"Institutional white"--"Tr. Yellow"--"Magenta"--
  131. Trailing = Instance.new("BoolValue",script)
  132. c0 = {
  133. ls = CFrame.new(-1,0.5,0),
  134. rs = CFrame.new(1,0.5,0),
  135. lh = CFrame.new(-1,-1,0),
  136. rh = CFrame.new(1,-1,0),
  137. nk = CFrame.new(0,1,0),
  138. tw = CFrame.new(0,0,0),
  139. }
  140. c1 = {
  141. ls = CFrame.new(0.5,0.5,0),
  142. rs = CFrame.new(-0.5,0.5,0),
  143. lh = CFrame.new(-.5,1,0),
  144. rh = CFrame.new(.5,1,0),
  145. nk = CFrame.new(0,-.5,0),
  146. tw = CFrame.new(0,0,0),
  147. }
  148. rs = Weld(torso,char:WaitForChild("Right Arm"),c0.rs,c1.rs)
  149. ls = Weld(torso,char:WaitForChild("Left Arm"),c0.ls,c1.ls)
  150. local lastPos
  151. lastSwing = tick()
  152. local top;
  153. ---------------------------------------------
  154. function Trail(par)
  155. lastPos = par.CFrame.p
  156. q(function()
  157. while Trailing.Value do
  158. wait(1/30)
  159. local obj = par:Clone()
  160. obj.Transparency = 0
  161. obj.Parent = workspace
  162. obj.Anchored = true
  163. obj.CanCollide = false
  164. distance = (lastPos-par.CFrame.p).magnitude
  165. obj.Size = Vector3.new(0,0,distance)
  166. obj.CFrame = CFrame.new(lastPos,par.Position)*CFrame.new(0,0,-distance/2)
  167. lastPos = par.CFrame.p
  168. q(function(p)wait(0.5)fade(p,0)for i=0,1,0.1 do wait(1/30)if p:FindFirstChild("Mesh") then local m = p:FindFirstChild("Mesh")local s = m.Scale
  169. if s.x>0 then
  170. m.Scale = s-Vector3.new(.075,0.075,0)
  171. end
  172. end end end,{obj})
  173. end
  174. end)
  175. end
  176. function Smoke(origin,color)
  177. local p = Part("Effect",workspace,Vector3.new(2,2,2),origin*CFrame.new(rand(5),-1,rand(5)),color or "Black",.25,false,false,"SmoothPlastic")
  178. local m = Mesh(p,"Sphere",Vector3.new(1.25,1.25,1.25))
  179. local bp = Instance.new("BodyPosition",p)bp.D = 100 bp.P = 100 bp.position = p.Position+Vector3.new(0,7,0)
  180. q(function(pa,me)
  181. fade(pa,.25)
  182. for i=25,100 do
  183. me.Scale = me.Scale+Vector3.new(0.15,0.1,0.15)
  184. wait(1/30)
  185. end
  186. pa:Destroy()
  187. end,{p,m})
  188. end
  189. function brickMagic(origin,color,size)
  190. local p = Part("Effect",workspace,Vector3.new(size,size,size),origin*CFrame.Angles(rand(5),rand(5),rand(5)),color,.2,true,false,"SmoothPlastic")
  191. local m = Mesh(p,"Brick")
  192. q(function(pa,me)
  193. fade(pa,.2)
  194. for i=20,100 do
  195. me.Scale = me.Scale-Vector3.new(0.05,0.05,0.05)
  196. wait(1/30)
  197. end
  198. pa:Destroy()
  199. end,{p,m})
  200. end
  201. function spikeMagic(origin,size,color)
  202. local p = Part("Effect",workspace,Vector3.new(1,1,1),origin*CFrame.new(0,-size,0),color,1,true,false,"SmoothPlastic")
  203. local m = Mesh(p,"FileMesh",Vector3.new(size/2,size*2,size/2),asset..meshes["spike"])
  204. q(function(pa,me)
  205. appear(pa)
  206. for i=1,size,.5 do
  207. wait(1/30)
  208. pa.CFrame = pa.CFrame*CFrame.new(0,.5,0)
  209. end
  210. wait(math.random(2,3))fade(pa,0)
  211. Delay(3,function()pa:Destroy()end)
  212. end,{p,m})
  213. end
  214. function placePart(origin,size,color,material)
  215. local p = Part("Effect",workspace,Vector3.new(size,size,size),origin*CFrame.Angles(rand(5),rand(5),rand(5)),color,0,true,true,material)
  216. local m = Mesh(p,"Brick")
  217. q(function(pa,me)
  218. wait(5)
  219. fade(pa,0)
  220. Delay(1.25,function()pa:Destroy()end)
  221. end,{p,m})
  222. end
  223. function crater(origin,dist)
  224. local b = workspace.Base
  225. local bc = b and tostring(b.BrickColor) or "Bright green"
  226. local m = b and b.Material or "Grass"
  227. for i=0,360,30 do
  228. local cf = origin*CFrame.Angles(0,math.rad(i),0)*CFrame.new(0,0,dist)*CFrame.Angles(math.rad(i/30),0,rand(5))
  229. placePart(cf,math.random(10,12),bc,m)
  230. end
  231. end
  232. function ringExplode(origin,color,size)
  233. local p = Part("Effect",workspace,Vector3.new(size,size,1),origin,color,.2,true,false,"SmoothPlastic")
  234. local m = Mesh(p,"FileMesh",Vector3.new(),asset..meshes["ring"])
  235. q(function(pa,me)
  236. fade(pa,.2)
  237. for i=.2,1,.025 do
  238. me.Scale = me.Scale-Vector3.new(0.5,0.5,0)
  239. wait(1/30)
  240. end
  241. pa:Destroy()
  242. end,{p,m})
  243. end
  244. function crownExplode(origin,color,size)
  245. local p = Part("Effect",workspace,Vector3.new(size,size,size),origin,color,.2,true,false,"SmoothPlastic")
  246. local m = Mesh(p,"FileMesh",Vector3.new(size/2,size/2,size/2),asset..meshes["crown"])
  247. q(function(pa,me)
  248. fade(pa,.2)
  249. for i=.2,1,.025 do
  250. me.Scale = me.Scale+Vector3.new(0.75,0.75,0.75)
  251. wait(1/30)
  252. end
  253. pa:Destroy()
  254. end,{p,m})
  255. end
  256. function glitter(origin,color)
  257. local p = Part("Effect",workspace,Vector3.new(0.75,0.75,0.75),origin*CFrame.new(rand(5),rand(5),rand(5))*CFrame.Angles(rand(5),rand(5),rand(5)),color,0,true,false,"SmoothPlastic")
  258. local m = Mesh(p,"Brick",Vector3.new(1,1,1))
  259. q(function(pa,me)
  260. fade(pa,0)
  261. for i=0,1,.05 do
  262. me.Scale = me.Scale-Vector3.new(0.05,0.05,0.05)
  263. wait(1/30)
  264. end
  265. pa:Destroy()
  266. end,{p,m})
  267. end
  268. function quickSound(id,v)
  269. local s = Instance.new("Sound",workspace)
  270. s.SoundId = id
  271. s.PlayOnRemove = true
  272. s.Volume = v or 1
  273. delay(0.025,function()s:remove()end)
  274. end
  275. function Shoot()
  276. quickSound(asset..sounds["gun"],.2)
  277. local start = top.CFrame*CFrame.Angles(math.pi/2,0,0)
  278. ringExplode(CFrame.new(start.p,start.p-(start.lookVector*-4)),mcolor,5)
  279. local vel = start.lookVector
  280. local p = Part("Bullet",workspace,Vector3.new(1,1,5),start,mcolor,0.4,true,false,"SmoothPlastic")
  281. local m = Mesh(p,"Sphere")
  282. local num = 0
  283. local ign = sword:children()
  284. local connect
  285. connect = step:connect(function()
  286. num = num + 1
  287. local pp = p.Position
  288. local h,po
  289. repeat
  290. local r = Ray.new(pp,vel.unit*math.min(999.5,vel.magnitude/30+20))
  291. h,po = workspace:FindPartOnRayWithIgnoreList(r,ign)
  292. if h then
  293. if h.CanCollide then
  294. break
  295. else
  296. table.insert(ign,h)
  297. h = nil
  298. end
  299. else
  300. break
  301. end
  302. until false
  303. p.CFrame = CFrame.new(po,po+vel)
  304. if h or num > 300 then
  305. local cf = p.CFrame
  306. q(function(cfz)
  307. for i=1,math.random(1,3)do
  308. Smoke(cfz,mcolor)
  309. end
  310. if h~=nil then
  311. local obj = h.CFrame:pointToObjectSpace(po)
  312. local siz = h.Size/2
  313. local svec = obj/siz
  314. svec = Vector3.new(math.floor(math.abs(svec.X)+.01)*svec.X/math.abs(svec.X),
  315. math.floor(math.abs(svec.Y))*svec.Y/math.abs(svec.Y) ,
  316. math.floor(math.abs(svec.Z))*svec.Z/math.abs(svec.Z))
  317. if svec.magnitude ~= 1 then return end
  318. local dir = h.CFrame:vectorToWorldSpace(svec)
  319. for i=1,math.random(1,3)do
  320. spikeMagic(CFrame.new(po,po-dir)*CFrame.new(math.random(-3,3),0,math.random(-3,3))*CFrame.Angles(math.pi/2,0,0),math.random(5,7),mcolor)
  321. end
  322. end
  323. end,{cf})
  324. if h and h.Parent~=char then
  325. local hum;
  326. for i,v in pairs(h.Parent:children())do if v:IsA("Humanoid")then hum = v end end
  327. if hum then hum:TakeDamage(25)end
  328. end
  329. p:Destroy()
  330. connect:disconnect()
  331. end
  332. end)
  333. end
  334. function dmgGui(player,dmg)
  335. end
  336. function checkDmgArea(origin,dmg,d)
  337. for i,v in pairs(workspace:children())do
  338. if v~=char and v:FindFirstChild("Torso") then
  339. local h;
  340. for _,k in pairs(v:children())do if k:IsA("Humanoid") then h = k end end
  341. local dist = (origin.p - v:FindFirstChild("Torso").CFrame.p).magnitude
  342. if dist < d and h~=nil then
  343. h.Health = h.Health - dmg
  344. end
  345. end
  346. end
  347. end
  348. --------------------------------------------- make the sword
  349. pcall(function()char:FindFirstChild("Sword"):Destroy()end)
  350. sword = Instance.new("Model",char)
  351. sword.Name = "Sword"
  352. handle = Part("Handle",sword,Vector3.new(0,1,0),torso.CFrame,mcolor,.4,false,false,"SmoothPlastic",.1)
  353. Mesh(handle,"Brick",Vector3.new(.75,1,.25))
  354. hweld = Weld(rarm,handle,CFrame.new(0,-1.1,0)*CFrame.Angles(-math.pi/2,math.pi/2,0))
  355. p1 = Part("P1",sword,Vector3.new(0,0,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  356. p1m = Instance.new("CylinderMesh",p1)
  357. p1m.Scale = Vector3.new(1.5,.3,1.5)
  358. p1w = Weld(handle,p1,CFrame.new(0,-.5,0))
  359. p2 = Part("P2",sword,Vector3.new(0,.5,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  360. p2m = Mesh(p2,"Brick",Vector3.new(.5,1.1,.5))
  361. p2w = Weld(handle,p2,CFrame.new(.05,-.25,0)*CFrame.Angles(0,0,-.1))
  362. p3 = Part("P3",sword,Vector3.new(0,.5,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  363. p3m = Mesh(p3,"Brick",Vector3.new(.5,1,.5))
  364. p3w = Weld(handle,p3,CFrame.new(.0765,.25,0)*CFrame.Angles(0,0,0))
  365. p4 = Part("P4",sword,Vector3.new(0,.5,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  366. p4m = Mesh(p4,"Brick",Vector3.new(.5,1.1,.5))
  367. p4w = Weld(handle,p4,CFrame.new(-.05,-.25,0)*CFrame.Angles(0,0,.1))
  368. p5 = Part("P5",sword,Vector3.new(0,.5,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  369. p5m = Mesh(p5,"Brick",Vector3.new(.5,1,.5))
  370. p5w = Weld(handle,p5,CFrame.new(-.0765,.25,0)*CFrame.Angles(0,0,0))
  371. p6 = Part("P6",sword,Vector3.new(0,0,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  372. p6m = Instance.new("CylinderMesh",p6)
  373. p6m.Scale = Vector3.new(1.5,.3,1.5)
  374. p6w = Weld(handle,p6,CFrame.new(.25,.5,0))
  375. p7 = Part("P7",sword,Vector3.new(0,0,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  376. p7m = Instance.new("CylinderMesh",p7)
  377. p7m.Scale = Vector3.new(1.5,.3,1.5)
  378. p7w = Weld(handle,p7,CFrame.new(-.25,.5,0))
  379. p8 = Part("P8",sword,Vector3.new(.5,0,.25),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  380. p8m = Mesh(p8,"Brick",Vector3.new(1,.3,1.185))
  381. p8w = Weld(handle,p8,CFrame.new(0,.5,0))
  382. p9 = Part("P9",sword,Vector3.new(0,0,0),torso.CFrame,mcolor,0.4,false,false,"SmoothPlastic")
  383. p9m = Instance.new("CylinderMesh",p9)
  384. p9m.Scale = Vector3.new(1.3,.3,1.3)
  385. p9w = Weld(handle,p9,CFrame.new(.25,.55,0))
  386. p10 = Part("P10",sword,Vector3.new(0,0,0),torso.CFrame,mcolor,0.4,false,false,"SmoothPlastic")
  387. p10m = Instance.new("CylinderMesh",p10)
  388. p10m.Scale = Vector3.new(1.3,.3,1.3)
  389. p10w = Weld(handle,p10,CFrame.new(-.25,.55,0))
  390. p11 = Part("P11",sword,Vector3.new(.5,0,.25),torso.CFrame,mcolor,0.4,false,false,"SmoothPlastic")
  391. p11m = Mesh(p11,"Brick",Vector3.new(1,.3,1.025))
  392. p11w = Weld(handle,p11,CFrame.new(0,.55,0))
  393. p12 = Part("P12",sword,Vector3.new(0,0,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  394. p12m = Instance.new("CylinderMesh",p12)
  395. p12m.Scale = Vector3.new(1.5,.3,1.5)
  396. p12w = Weld(handle,p12,CFrame.new(.25,.6,0))
  397. p13 = Part("P13",sword,Vector3.new(0,0,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  398. p13m = Instance.new("CylinderMesh",p13)
  399. p13m.Scale = Vector3.new(1.5,.3,1.5)
  400. p13w = Weld(handle,p13,CFrame.new(-.25,.6,0))
  401. p14 = Part("P14",sword,Vector3.new(.5,0,.25),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  402. p14m = Mesh(p14,"Brick",Vector3.new(1,.3,1.185))
  403. p14w = Weld(handle,p14,CFrame.new(0,.6,0))
  404. blade = Part("Blade",sword,Vector3.new(.75,4,0),torso.CFrame,mcolor,.4,false,false,"SmoothPlastic",.1)
  405. bladem = Mesh(blade,"Brick",Vector3.new(1,1,.1))
  406. bladew = Weld(handle,blade,CFrame.new(0,2.625,0))
  407. blight = Instance.new("PointLight",blade)
  408. blight.Color = BrickColor.new(mcolor).Color
  409. p15 = WedgePart("P15",sword,Vector3.new(4,0,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  410. p15m = Mesh(p15,"Wedge",Vector3.new(1,.1,1.25))
  411. p15w = Weld(blade,p15,CFrame.new(-.25,0,-0.02)*CFrame.Angles(-math.pi/2,math.pi/2,0))
  412. p16 = WedgePart("P16",sword,Vector3.new(4,0,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  413. p16m = Mesh(p16,"Wedge",Vector3.new(1,.1,1.25))
  414. p16w = Weld(blade,p16,CFrame.new(-.25,0,0.02)*CFrame.Angles(math.pi/2,math.pi/2,0))
  415. p17 = WedgePart("P17",sword,Vector3.new(4,0,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  416. p17m = Mesh(p17,"Wedge",Vector3.new(1,.1,1.25))
  417. p17w = Weld(blade,p17,CFrame.new(.25,0,0.02)*CFrame.Angles(math.pi/2,-math.pi/2,0))
  418. p18 = WedgePart("P18",sword,Vector3.new(4,0,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  419. p18m = Mesh(p18,"Wedge",Vector3.new(1,.1,1.25))
  420. p18w = Weld(blade,p18,CFrame.new(.25,0,-0.02)*CFrame.Angles(-math.pi/2,-math.pi/2,0))
  421. p19 = Part("P19",sword,Vector3.new(.75,0,0),torso.CFrame,"Grey",1,false,false,"SmoothPlastic")
  422. p19m = Mesh(p19,"Brick",Vector3.new(1,.625,.1))
  423. p19w = Weld(blade,p19,CFrame.new(0,2.2,0))
  424. p20 = WedgePart("P20",sword,Vector3.new(0,0,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  425. p20m = Mesh(p20,"Wedge",Vector3.new(.1,3.6,1.25))
  426. p20w = Weld(p19,p20,CFrame.new(-.25,.16,0)*CFrame.Angles(0,math.pi/2,0))
  427. p21 = WedgePart("P20",sword,Vector3.new(0,0,0),torso.CFrame,"Grey",0,false,false,"SmoothPlastic")
  428. p21m = Mesh(p21,"Wedge",Vector3.new(.1,3.6,1.25))
  429. p21w = Weld(p19,p21,CFrame.new(.25,.16,0)*CFrame.Angles(0,-math.pi/2,0))
  430. top = Part("Tip",sword,Vector3.new(0,0,0),torso.CFrame,mcolor,1,false,false,"SmoothPlastic")
  431. topm = Mesh(top,"Brick")
  432. topw = Weld(p19,top,CFrame.new(0,1,0))
  433. ohw = hweld.C0
  434. --------------------------------------------- events and main loop
  435. mouse.Button1Down:connect(function()
  436. if Mode=="" then
  437. Mode = "Swing1"
  438. coroutine.wrap(function()
  439. for i=1,math.random(3,4)do
  440. local cf = torso.CFrame*CFrame.new(rand(5),0,rand(5))
  441. checkDmgArea(cf,20,5)
  442. spikeMagic(cf,math.random(4,6),mcolor)
  443. end
  444. end)()
  445. elseif Mode=="Swing1" then
  446. Delay(0.2,function()ringExplode(top.CFrame*CFrame.Angles(math.pi/2,0,0),mcolor,1)end)
  447. Mode = "Swing2"
  448. elseif Mode=="Swing2" then
  449. Delay(0.2,function()
  450. for i=1,math.random(2,4)do
  451. Smoke(top.CFrame,mcolor)
  452. checkDmgArea(top.CFrame,20,5)
  453. end
  454. end)
  455. Mode = "Swing3"
  456. elseif Mode=="Swing3" then
  457. Mode = ""
  458. elseif Mode=="Shoot" then
  459. Shoot()
  460. end
  461. lastSwing = tick()
  462. end)
  463. mouse.KeyDown:connect(function(key)
  464. key:lower()
  465. if key=="l"then
  466. if Mode~="Shoot" then
  467. Mode = "Shoot"
  468. elseif Mode=="Shoot" then
  469. Mode = ""
  470. end
  471. end
  472. end)
  473. Trailing.Changed:connect(function()
  474. if Trailing.Value then
  475. Trail(top)
  476. end
  477. end)
  478. count = 0
  479. angle = 0
  480. counttime = 70
  481. countspeed = 1
  482. speed = .3
  483. step:connect(function() -- main loop
  484. count = (count%counttime)+countspeed
  485. angle = math.pi*math.cos((math.pi*2)/counttime*count)
  486. torVel = Vector3.new(torso.Velocity.x,0,torso.Velocity.z)
  487. if (tick()-lastSwing) > .8 and Mode:match("Swing") then
  488. Mode = ""
  489. end
  490. if Mode=="" then
  491. Trailing.Value = false
  492. rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(math.pi/4,0,-math.pi/6),.2)
  493. ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-math.pi/6,0,0),.2)
  494. hweld.C0 = clerp(hweld.C0,ohw,.5)
  495. elseif Mode=="Swing1" then
  496. Trailing.Value = true
  497. glitter(top.CFrame,mcolor)
  498. rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(math.pi,0,0),.5)
  499. ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(math.pi/6,0,math.pi/5),.2)
  500. hweld.C0 = clerp(hweld.C0,ohw*CFrame.Angles(0,0,-math.pi/2),.5)
  501. elseif Mode=="Swing2" then
  502. Trailing.Value = true
  503. glitter(top.CFrame,mcolor)
  504. rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(math.pi/6,0,math.pi/5),.5)
  505. ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(math.pi/6,0,math.pi/4),.2)
  506. hweld.C0 = clerp(hweld.C0,ohw*CFrame.Angles(0,0,-math.pi/8),.5)
  507. elseif Mode=="Swing3" then
  508. Trailing.Value = true
  509. glitter(top.CFrame,mcolor)
  510. rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(math.pi/2,0,-math.pi/3),.5)
  511. ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(math.pi/2,0,math.pi/8),.5)
  512. hweld.C0 = clerp(hweld.C0,ohw*CFrame.Angles(0,0,-math.pi/2),.5)
  513. elseif Mode=="Shoot" then
  514. Trailing.Value = true
  515. local mpos = torso.CFrame * rs.c0 -- thx doogle <3
  516. local cf = CFrame.new(mpos.p,mouse.Hit.p) * CFrame.Angles(math.pi/2,0,0)
  517. local x,y,z = torso.CFrame:toObjectSpace(cf):toEulerAnglesXYZ()
  518. rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(x,y,z),.5)
  519. ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-math.pi/6,0,0),.5)
  520. hweld.C0 = clerp(hweld.C0,ohw*CFrame.Angles(0,0,-math.pi/2),.5)
  521. elseif Mode=="Summoning" then
  522. Trailing.Value = false
  523. rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(math.pi,0,0),.2)
  524. ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(math.pi,0,0),.2)
  525. hweld.C0 = clerp(hweld.C0,ohw*CFrame.Angles(0,0,-math.pi/2),.5)
  526. end
  527. LastMode = Mode
  528. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement