Advertisement
BabyGoatz

Untitled

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