VanishingDragon

Untitled

May 20th, 2017
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.00 KB | None | 0 0
  1. Players = game:GetService("Players")
  2.  
  3. me = Players['VanishingDragone']
  4. char = me.Character
  5.  
  6. Toolname = "Tanto"
  7. Modelname = "Tanto"
  8.  
  9. selected = false
  10. effect = false
  11. hurt = false
  12. debounce = true
  13. able = true
  14. charge = false
  15. soundable = true
  16. cancharge = true
  17. cam = game.Workspace.CurrentCamera
  18.  
  19. surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  20.  
  21. New = {
  22. Gyro = function(P)
  23. local bg = Instance.new("BodyGyro", P)
  24. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  25. bg.P = 14000
  26. return bg
  27. end,
  28. Position = function(P)
  29. local bp = Instance.new("BodyPosition", P)
  30. bp.maxForce = Vector3.new(math.huge, 0, math.huge)
  31. bp.P = 14000
  32. return bp
  33. end,
  34. Force = function(P)
  35. local bf = Instance.new("BodyForce", P)
  36. bf.force = Vector3.new(0, P:GetMass()*187, 0)
  37. return bf
  38. end,
  39. Sound = function(P, ID, vol, pitch)
  40. local s = Instance.new("Sound")
  41. s.SoundId = ID
  42. s.Volume = vol
  43. s.Pitch = pitch
  44. s.Parent = P
  45. return s
  46. end
  47. }
  48.  
  49. torso = char.Torso
  50. neck = torso.Neck
  51. human = char.Humanoid
  52. Rarm = char["Right Arm"]
  53. Larm = char["Left Arm"]
  54. Rleg = char["Right Leg"]
  55. Lleg = char["Left Leg"]
  56.  
  57. Sounds = {
  58. slash = "rbxasset://sounds//swordslash.wav",
  59. unsheath = "rbxasset://sounds//unsheath.wav",
  60. hitsound = "http://www.roblox.com/asset/?id=2801263", --0.5
  61. charge = "http://www.roblox.com/asset/?id=2101137", --0.5
  62. boom = "http://www.roblox.com/asset/?id=2691586", --0.3
  63. bewm = "http://www.roblox.com/asset/?id=2760979", --0.3
  64. splat = "http://roblox.com/asset/?id=10209590"
  65. }
  66.  
  67. function EnableSound(time)
  68. coroutine.resume(coroutine.create(function()
  69. wait(time)
  70. soundable = true
  71. end))
  72. end
  73.  
  74. function PlaySound(soundname, pitch)
  75. if soundable then
  76. soundable = false
  77. local s = New.Sound(torso, Sounds[soundname], 0.5, pitch)
  78. s.PlayOnRemove = true
  79. if pitch < 0 then
  80. coroutine.resume(coroutine.create(function()
  81. s.Looped = true
  82. s.PlayOnRemove = false
  83. wait()
  84. s:Play()
  85. wait(.2)
  86. s.Looped = false
  87. wait()
  88. s:remove()
  89. end))
  90. else
  91. coroutine.resume(coroutine.create(function()
  92. wait()
  93. s:remove()
  94. s.Looped=false
  95. end))
  96. end
  97. EnableSound(0.12)
  98. return s
  99. end
  100. end
  101.  
  102. function Weld(p0, p1, x, y, z, a, b, c)
  103. local w = Instance.new("Weld")
  104. w.Parent = p0
  105. w.Part0 = p0
  106. w.Part1 = p1
  107. w.C1 = CFrame.new(x, y, z) * CFrame.Angles(a, b, c)
  108. return w
  109. end
  110.  
  111. function Part(parent, anchor, collide, tran, ref, color, x, y, z, Break, lifetime)
  112. local p = Instance.new("Part")
  113. p.formFactor = "Custom"
  114. p.Anchored = anchor
  115. p.CanCollide = collide
  116. p.Transparency = tran
  117. p.Reflectance = ref
  118. p.BrickColor = BrickColor.new(color)
  119. for _, Surf in pairs(surfaces) do
  120. p[Surf] = "Smooth"
  121. end
  122. p.Size = Vector3.new(x, y, z)
  123. if Break then
  124. p:BreakJoints()
  125. else
  126. p:MakeJoints()
  127. end
  128. p.Parent = parent
  129. p.Locked = true
  130. if lifetime then
  131. game:GetService("Debris"):AddItem(p, lifetime)
  132. end
  133. return p
  134. end
  135.  
  136. function getHum(c)
  137. local h = nil
  138. for i,v in pairs(c:GetChildren()) do
  139. if v:IsA("Humanoid") and c ~= char then
  140. if v.Health > 0 then
  141. h = v
  142. end
  143. end
  144. end
  145. return h
  146. end
  147.  
  148. for i, v in pairs(char:children()) do
  149. if v.Name == Modelname then
  150. v:remove()
  151. end
  152. end
  153.  
  154. for i, v in pairs(me.Backpack:GetChildren()) do
  155. if v.Name == Toolname then
  156. v:remove()
  157. end
  158. end
  159.  
  160. Mo = Instance.new("Model")
  161. Mo.Name = Modelname
  162.  
  163. RABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  164. LABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  165. RLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  166. LLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  167. gripBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  168. Weld(Rarm, gripBrick, 0, 1, 0, 0, 0, 0)
  169.  
  170. RABW = Weld(torso, RABrick, -1.5, -0.5, 0, 0, 0, 0)
  171. LABW = Weld(torso, LABrick, 1.5, -0.5, 0, 0, 0, 0)
  172. RLBW = Weld(torso, RLBrick, -0.5, 1.2, 0, 0, 0, 0)
  173. LLBW = Weld(torso, LLBrick, 0.5, 1.2, 0, 0, 0, 0)
  174.  
  175. TH = Weld(Rleg, nil, -0.6, 0, 0, math.pi/6, 0, 0)
  176.  
  177. RABW2 = Weld(RABrick, nil, 0, 0.5, 0, 0, 0, 0)
  178. LABW2 = Weld(LABrick, nil, 0, 0.5, 0, 0, 0, 0)
  179. RLBW2 = Weld(RLBrick, nil, 0, 0.77, 0, 0, 0, 0)
  180. LLBW2 = Weld(LLBrick, nil, 0, 0.77, 0, 0, 0, 0)
  181.  
  182. handle = Part(Mo, false, false, 0, 0, "Really black", 0.2, 0.8, 0.3, true)
  183. handle.Name = "Handle"
  184. Instance.new("BlockMesh", handle).Scale = Vector3.new(0.8, 1, 0.8)
  185.  
  186. guard = Part(Mo, false, false, 0, 0, "Really black", 0.35, 0.2, 0.45, true)
  187. guard.Name = "Guard"
  188. Instance.new("BlockMesh", guard).Scale = Vector3.new(0.8, 0.5, 0.8)
  189.  
  190. blade = Part(Mo, false, false, 0, 0.1, "Really blue", 0.2, 1.15, 0.3, true)
  191. blade.Name = "Blade"
  192. Instance.new("BlockMesh", blade).Scale = Vector3.new(0.1, 1, 0.8)
  193.  
  194. bladetip = Part(Mo, false, false, 0, 0.1, "Really blue", 0.2, 0.3, 0.3, true)
  195. bladetip.Name = "Tip"
  196. bladetipmesh = Instance.new("SpecialMesh", bladetip)
  197. bladetipmesh.MeshType = "Wedge"
  198. bladetipmesh.Scale = Vector3.new(0.1, 1, 0.8)
  199.  
  200. sheath = Part(Mo, false, false, 0, 0, "Really black", 0.3, 1.5, 0.4, true)
  201. sheath.Name = "Sheath"
  202. Instance.new("BlockMesh", sheath)
  203.  
  204. sheathweld = Weld(sheath, blade, 0, 0.23, 0, math.pi, 0, 0)
  205. grip = Weld(gripBrick, nil, 0, 0, 0, -math.pi/2, 0, 0)
  206. Weld(handle, guard, 0, -0.4, 0, 0, 0, 0)
  207. Weld(guard, blade, 0, -0.575, 0, 0, 0, 0)
  208. Weld(blade, bladetip, 0, -0.725, 0, 0, 0, 0)
  209.  
  210. Mo.Parent = char
  211. TH.Part1 = sheath
  212.  
  213. if not script.Parent:IsA("HopperBin") then
  214. bin = Instance.new("HopperBin", me.Backpack)
  215. bin.Name = Toolname
  216. script.Parent = bin
  217. end
  218.  
  219. function dmg(hum, dm1, dm2)
  220. local dmg = math.random(dm1, dm2)
  221. local ko = Instance.new("ObjectValue", hum)
  222. ko.Name = "creator"
  223. ko.Value = me
  224. hum.Health = hum.Health - dmg
  225. coroutine.resume(coroutine.create(function()
  226. wait()
  227. ko:remove()
  228. end))
  229. for i = 0, dmg/5 do
  230. local blood = Part(workspace, false, false, 0, 0, "Really red", 0.2, 0.2, 0.2, true)
  231. blood.CFrame = hum.Parent.Torso.CFrame
  232. blood.RotVelocity = Vector3.new(math.random(-10,10), math.random(-10,10), math.random(-10,10))
  233. blood.Velocity = Vector3.new(math.random(-20,20), math.random(5,20), math.random(-20,20))
  234. --Instance.new("SpecialMesh", blood).MeshType = "Sphere"
  235. coroutine.resume(coroutine.create(function()
  236. for i = 0, 3, 0.1 do
  237. --blood.SpecialMesh.Scale = Vector3.new(1 - i, 1 - i, 1 - i)
  238. blood.Transparency = i / 3
  239. wait()
  240. end
  241. end))
  242. end
  243. return dmg
  244. end
  245.  
  246. function unsheath()
  247. PlaySound("unsheath", 2)
  248. coroutine.resume(coroutine.create(function()
  249. for i = 0, 90, 15 do
  250. RABW2.C1 = CFrame.new(0, 0.5, math.sin(i/29)/6) * CFrame.Angles(-math.rad(i), 0, 0)
  251. wait()
  252. end
  253. wait()
  254. RABW2.C1 = CFrame.new(0, 0.5, 0) * CFrame.Angles(-math.rad(90), 0, 0)
  255. end))
  256. coroutine.resume(coroutine.create(function()
  257. wait()
  258. wait()
  259. for i = 0, 180, 30 do
  260. for _, v in pairs(game.Workspace:GetChildren()) do
  261. if getHum(v)~=nil then
  262. if v:findFirstChild("Torso")~=nil then
  263. if (v.Torso.Position - blade.Position).magnitude < 2 then
  264. local hum = getHum(v)
  265. dmg(hum, 4, 6)
  266. PlaySound("splat", 1.2)
  267. end
  268. end
  269. end
  270. end
  271. wait()
  272. end
  273. end))
  274. wait()
  275. wait()
  276. sheathweld.Part1 = nil
  277. grip.Part1 = handle
  278. for i = 0, -180, -30 do
  279. wait()
  280. grip.C1 = CFrame.new(0, -0.2, 0) * CFrame.Angles(math.rad(i) - math.rad(90), 0, 0) --(math.sin(i/59)/6)
  281. end
  282. end
  283.  
  284. function sheath()
  285. PlaySound("unsheath", -2)
  286. coroutine.resume(coroutine.create(function()
  287. for i = 90, 0, -15 do
  288. RABW2.C1 = CFrame.new(0, 0.5, math.sin(i/29)/6) * CFrame.Angles(-math.rad(i), 0, 0)
  289. wait()
  290. end
  291. end))
  292. coroutine.resume(coroutine.create(function()
  293. for i = -180, 0, 30 do
  294. grip.C1 = CFrame.new(0, -0.2, 0) * CFrame.Angles(math.rad(i) - math.rad(90), 0, 0) --(math.sin(i/59)/6)
  295. wait()
  296. end
  297. end))
  298. coroutine.resume(coroutine.create(function()
  299. wait()
  300. wait()
  301. for i = 0, 180, 30 do
  302. for _, v in pairs(game.Workspace:GetChildren()) do
  303. if getHum(v)~=nil then
  304. if v:findFirstChild("Torso")~=nil then
  305. if (v.Torso.Position - blade.Position).magnitude < 2 then
  306. local hum = getHum(v)
  307. dmg(hum, 3, 5)
  308. PlaySound("splat", 1.2)
  309. end
  310. end
  311. end
  312. end
  313. wait()
  314. end
  315. end))
  316. for i = 90, 30, -15 do
  317. wait()
  318. end
  319. grip.Part1 = nil
  320. sheathweld.Part1 = blade
  321. end
  322.  
  323. function freeze(m)
  324. local trg = m.Target
  325. if (trg==nil) then return end
  326. local phit = game.Players:findFirstChild(trg.Parent.Name)
  327. if (phit~=nil) then
  328. if (phit==p) then return end
  329. local char = trg.Parent
  330. if (char:findFirstChild("Torso")==nil) then return end
  331. if (char:findFirstChild("fr_block")==nil) then
  332. local pa = Instance.new("Part")
  333. local bl = Instance.new("BlockMesh")
  334. bl.Parent = pa
  335. pa.Anchored = true
  336. pa.Name = "fr_block"
  337. pa.Transparency = 1
  338. pa.BrickColor = BrickColor.New("Really blue")
  339. pa.FormFactor = "Custom"
  340. pa.Size = Vector3.new(6,7,6)
  341. pa.CFrame = char["Torso"].CFrame
  342. pa.Parent = char
  343. char.Humanoid.WalkSpeed = 0
  344. if (char.Humanoid.Health<char.Humanoid.MaxHealth/4) then
  345. char.Humanoid.Health = 0
  346. else
  347. char.Humanoid.Health = char.Humanoid.Health - char.Humanoid.MaxHealth/4
  348. end
  349. local g = char:GetChildren()
  350. for i = 1,#g do
  351. if (g[i]:IsA("Part")) then
  352. g[i].Anchored = true
  353. g[i].Reflectance = .3
  354. end
  355. end
  356. for i = 1,10 do
  357. pa.Transparency = pa.Transparency - .06
  358. pa.Reflectance = pa.Reflectance + .01
  359. wait(.01)
  360. end
  361. else
  362. if (phit~=nil) then
  363. local fr = char["fr_block"]
  364. local char = trg.Parent
  365. for i = 1,10 do
  366. fr.Transparency = fr.Transparency + .06
  367. fr.Reflectance = fr.Reflectance - .01
  368. wait(.01)
  369. end
  370. local g = char:GetChildren()
  371. for i = 1,#g do
  372. if (g[i]:IsA("Part")) then
  373. g[i].Anchored = false
  374. g[i].Reflectance = 0
  375. end
  376. end
  377. char.Humanoid.WalkSpeed = 16
  378. fr:remove()
  379. end
  380. end
  381. end
  382. end
  383.  
  384. function explode(m)
  385. local t = m.Hit.p
  386. local trg = m.Target
  387. if (trg==nil) then return end
  388. local e = Instance.new("Explosion")
  389. e.BlastRadius = 20
  390. e.BlastPressure = 20
  391. e.Position = t
  392. e.Parent = game.Workspace
  393. end
  394.  
  395. function fire(m)
  396. local trg = m.Target
  397. if (trg==nil) then return end
  398. local phit = game.Players:findFirstChild(trg.Parent.Name)
  399. if (phit~=nil) then
  400. local char = trg.Parent
  401. if (char:findFirstChild("Torso")==nil) then return end
  402. local f = Instance.new("Fire")
  403. f.Color = Color3.new(0,0,0)
  404. f.SecondaryColor = Color3.new(0,5,0)
  405. f.Parent = char.Torso
  406. f.Name = "BurnFire"
  407. coroutine.resume(coroutine.create(function()
  408. while (char.Humanoid.Health>0) do
  409. if (char.Humanoid.Health<2) then
  410. char.Humanoid.Health = 0
  411. char:BreakJoints()
  412. else
  413. char.Humanoid.Health = char.Humanoid.Health - 2
  414. end
  415. wait(.05)
  416. end
  417. end))
  418. end
  419. end
  420.  
  421. function slash()
  422. PlaySound("slash", math.random(1750,2000)/1000)
  423. coroutine.resume(coroutine.create(function()
  424. for i = 90, 0, -30 do
  425. RABW2.C1 = CFrame.new(0, 0.5, math.sin(i/29)/6) * CFrame.Angles(-math.rad(i), 0, 0)
  426. wait()
  427. end
  428. for i = 0, 90, 30 do
  429. RABW2.C1 = CFrame.new(0, 0.5, math.sin(i/29)/6) * CFrame.Angles(-math.rad(i), 0, 0)
  430. wait()
  431. end
  432. end))
  433.  
  434. for i = 0, 180, 30 do
  435. for _, v in pairs(game.Workspace:GetChildren()) do
  436. if getHum(v)~=nil then
  437. if v:findFirstChild("Torso")~=nil then
  438. if (v.Torso.Position - blade.Position).magnitude < 2 then
  439. local hum = getHum(v)
  440. dmg(hum, 3, 5)
  441. PlaySound("splat", 1)
  442. end
  443. end
  444. end
  445. end
  446. wait()
  447. end
  448. end
  449.  
  450. function stab()
  451. coroutine.resume(coroutine.create(function()
  452. for i = 0.5, -0.3, -0.1 do
  453. RABW2.C1 = CFrame.new(0, i, 0) * CFrame.Angles(-math.rad(90), 0, 0)
  454. wait()
  455. end
  456. for i = 180, 270, 30 do
  457. grip.C1 = CFrame.new(0, -0.2, 0) * CFrame.Angles(math.rad(i) - math.rad(90), 0, 0) --(math.sin(i/59)/6)
  458. wait()
  459. end
  460. wait(0.1)
  461. PlaySound("slash", math.random(1700,1900)/1000)
  462. for i = -0.25, 0.5, 0.25 do
  463. RABW2.C1 = CFrame.new(0, i, 0) * CFrame.Angles(-math.rad(90), 0, 0)
  464. wait()
  465. end
  466. for i = 270, 180, -10 do
  467. grip.C1 = CFrame.new(0, -0.2, 0) * CFrame.Angles(math.rad(i) - math.rad(90), 0, 0) --(math.sin(i/59)/6)
  468. wait()
  469. end
  470. end))
  471. for i = -0.3, 0.5, 0.1 do
  472. wait()
  473. end
  474. for i = 180, 270, 30 do
  475. wait()
  476. end
  477. for i = 0, 0.5, 0.25 do
  478. for _, v in pairs(game.Workspace:GetChildren()) do
  479. if getHum(v)~=nil then
  480. if v:findFirstChild("Torso")~=nil then
  481. if (v.Torso.Position - blade.Position).magnitude < 2 then
  482. local hum = getHum(v)
  483. dmg(hum, 10, 15)
  484. --PlaySound("hitsound", 1.2)
  485. PlaySound("splat", 0.6)
  486. end
  487. end
  488. end
  489. end
  490. wait()
  491. end
  492. for i = 180, 270, 30 do
  493. for _, v in pairs(game.Workspace:GetChildren()) do
  494. if getHum(v)~=nil then
  495. if v:findFirstChild("Torso")~=nil then
  496. if (v.Torso.Position - blade.Position).magnitude < 2 then
  497. local hum = getHum(v)
  498. dmg(hum, 1, 1)
  499. end
  500. end
  501. end
  502. end
  503. wait()
  504. end
  505. end
  506.  
  507. function slice()
  508. coroutine.resume(coroutine.create(function()
  509. for i = 0, 60, 15 do
  510. RABW2.C1 = CFrame.new(.3, math.sin(i/29)/6 + .1, 0) * CFrame.Angles(-math.rad(90), math.rad(i), 0)
  511. wait()
  512. end
  513. wait(.1)
  514. PlaySound("slash", math.random(1700,1900)/1000)
  515. wait(.1)
  516. for i = 60, -60, -30 do
  517. RABW2.C1 = CFrame.new(.25, math.sin(i/29)/6 + 1, 0) * CFrame.Angles(-math.rad(90), math.rad(i), 0)
  518. wait()
  519. end
  520. end))
  521. coroutine.resume(coroutine.create(function()
  522. for i = 180, 270, 30 do
  523. grip.C1 = CFrame.new(0, -0.2, 0) * CFrame.Angles(math.rad(i) - math.rad(90), -math.rad(i), 0) --(math.sin(i/59)/6)
  524. wait()
  525. end
  526. end))
  527. for i = 0, 150, 15 do
  528. wait()
  529. end
  530. for i = 0, 180, 30 do
  531. for _, v in pairs(game.Workspace:GetChildren()) do
  532. if getHum(v)~=nil then
  533. if v:findFirstChild("Torso")~=nil then
  534. if (v.Torso.Position - blade.Position).magnitude < 2 then
  535. local hum = getHum(v)
  536. dmg(hum, 45, 60 - (v.Torso.Position - blade.Position).magnitude * 5)
  537. PlaySound("hitsound", 1.5)
  538. end
  539. end
  540. end
  541. end
  542. wait()
  543. end
  544. wait(.3)
  545. for i = -60, 0, 30 do
  546. RABW2.C1 = CFrame.new(0, math.sin(i/29)/6 + 0.5, 0) * CFrame.Angles(-math.rad(90), math.rad(i), 0)
  547. wait()
  548. end
  549. for i = 270, 180, -30 do
  550. grip.C1 = CFrame.new(0, -0.2, 0) * CFrame.Angles(math.rad(i) - math.rad(90), 0, 0) --(math.sin(i/59)/6)
  551. wait()
  552. end
  553. end
  554.  
  555. function select(mouse)
  556. RABW2.Part1 = Rarm
  557. LABW2.Part1 = nil
  558. RLBW2.Part1 = nil
  559. LLBW2.Part1 = nil
  560. unsheath()
  561. mouse.Button1Down:connect(function()
  562. if able then
  563. able = false
  564. slash(mouse.Hit.p)
  565. able = true
  566. end
  567. end)
  568. mouse.KeyDown:connect(function(key)
  569. if able then
  570. key = key:lower()
  571. if key == "z" then
  572. able = false
  573. slash(mouse.Hit.p)
  574. able = true
  575. elseif key == "x" then
  576. able = false
  577. stab(mouse.Hit.p)
  578. able = true
  579. elseif key == "c" then
  580. able = false
  581. slice(mouse.Hit.p)
  582. able = true
  583. elseif key == "v" then
  584. freeze(mouse)
  585. elseif key == "b" then
  586. explode(mouse)
  587. elseif key == "n" then
  588. fire(mouse)
  589. end
  590. end
  591. end)
  592. end
  593.  
  594. function deselect()
  595. sheath()
  596. RABW2.Part1 = nil
  597. LABW2.Part1 = nil
  598. RLBW2.Part1 = nil
  599. LLBW2.Part1 = nil
  600. end
  601.  
  602. bin.Selected:connect(select)
  603. bin.Deselected:connect(deselect)
Add Comment
Please, Sign In to add comment