Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.18 KB | None | 0 0
  1. Name = "FirstNamer"
  2. me = game.Players[FirstNamer]
  3. char = me.Character
  4. Modelname = "SoulBall"
  5. Dist = 2.5
  6. Surfaces = {"FrontSurface", "BackSurface", "TopSurface", "BottomSurface", "LeftSurface", "RightSurface"}
  7. necko = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  8. able = true
  9. ball = nil
  10.  
  11. Add = {
  12. Sphere = function(P)
  13. local m = Instance.new("SpecialMesh",P)
  14. m.MeshType = "Sphere"
  15. return m
  16. end,
  17. BF = function(P)
  18. local bf = Instance.new("BodyForce",P)
  19. bf.force = Vector3.new(0, P:GetMass()*187, 0)
  20. return bf
  21. end,
  22. BP = function(P)
  23. local bp = Instance.new("BodyPosition",P)
  24. bp.maxForce = Vector3.new(math.huge, 0, math.huge)
  25. bp.P = 14000
  26. return bp
  27. end,
  28. BG = function(P)
  29. local bg = Instance.new("BodyGyro",P)
  30. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  31. bg.P = 8000
  32. return bg
  33. end
  34. }
  35.  
  36. function GetNoobs(Pos, Mag)
  37. local obs = {}
  38. for i,v in pairs(workspace:children()) do
  39. if v:IsA("Model") and v ~= char then
  40. local t, h, j = v:findFirstChild("Torso"), v:findFirstChild("Humanoid"), v:findFirstChild("Hp")
  41. if t ~= nil and h ~= nil and j ~= nil then
  42. local p = nil
  43. local d = Mag
  44. for a,k in pairs(v:children()) do
  45. if k:IsA("BasePart") then
  46. if (k.Position - Pos).magnitude < d then
  47. p = k
  48. d = (k.Position - Pos).magnitude
  49. end
  50. end
  51. end
  52. if p ~= nil then
  53. table.insert(obs, {t, h, j})
  54. end
  55. end
  56. end
  57. end
  58. return obs
  59. end
  60.  
  61. function Part(Parent, Anchor, Collide, Tran, Ref, Color, X, Y, Z, Break)
  62. local p = Instance.new("Part")
  63. p.formFactor = "Custom"
  64. p.Anchored = Anchor
  65. p.CanCollide = Collide
  66. p.Transparency = Tran
  67. p.Reflectance = Ref
  68. p.BrickColor = BrickColor.new(Color)
  69. for _, Surf in pairs(Surfaces) do
  70. p[Surf] = "Smooth"
  71. end
  72. p.Size = Vector3.new(X, Y, Z)
  73. if Break then
  74. p:BreakJoints()
  75. else p:MakeJoints() end
  76. p.Parent = Parent
  77. return p
  78. end
  79.  
  80. function Weld(p0, p1, x, y, z, a, b, c)
  81. local w = Instance.new("Weld")
  82. w.Parent = p0
  83. w.Part0 = p0
  84. w.Part1 = p1
  85. w.C1 = CFrame.Angles(a,b,c) * CFrame.new(x,y,z)
  86. return w
  87. end
  88.  
  89. function ComputePos(pos1, pos2)
  90. local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z)
  91. return CFrame.new(pos1, pos3)
  92. end
  93.  
  94. for i,v in pairs(char:children()) do
  95. if v.Name == Modelname then
  96. v:remove()
  97. end
  98. end
  99.  
  100. torso = char.Torso
  101. neck = torso.Neck
  102. hum = char.Humanoid
  103. Rarm = char["Right Arm"]
  104. Larm = char["Left Arm"]
  105. Rleg = char["Right Leg"]
  106. Lleg = char["Left Leg"]
  107.  
  108. throwsound = Instance.new("Sound")
  109. throwsound.SoundId = "rbxasset://sounds//swordslash.wav"
  110. throwsound.Volume = 0.8
  111. throwsound.Pitch = 1.2
  112. throwsound.Parent = Rarm
  113. hitsound = Instance.new("Sound")
  114. hitsound.SoundId = "http://www.roblox.com/asset/?id=2801263"
  115. hitsound.Volume = 0.55
  116. hitsound.Pitch = 1.8
  117.  
  118. Mo = Instance.new("Model")
  119. Mo.Name = Modelname
  120.  
  121. main = Part(Mo, false, false, 0, 0, "Brown", 2, 2, 0.2, true)
  122. Weld(torso, main, 0, 0, -0.6, 0, 0, 0)
  123. Floor = Part(Mo, false, false, 0, 0, "Reddish brown", 1.95, 0.2, 1, true)
  124. Weld(main, Floor, 0, 0.93, -0.4, 0, 0, 0)
  125.  
  126. for i=-0.9, 1, 1.8 do
  127. local side = Part(Mo, false, false, 0, 0, "Brown", 0.2, 2, 0.8, true)
  128. Weld(main, side, i, 0, -0.36, 0, 0, 0)
  129. end
  130.  
  131. for i = -60, 55, 15 do
  132. local ba = Part(Mo, false, false, 0, 0, "Brown", 2, 0.44, 0.2, true)
  133. local wa = Weld(main, ba, 0, 0, 0, 0, 0, 0)
  134. wa.C0 = CFrame.new(0,-0.1,0.1) * CFrame.Angles(math.rad(i),0,0)
  135. wa.C1 = CFrame.new(0,0,-1.1)
  136. for x=-0.9, 1, 1.8 do
  137. local si = Part(Mo, false, false, 0, 0, "Brown", 0.2, 0.5, 0.7, true)
  138. Weld(ba, si, x, 0, 0.34, 0, 0, 0)
  139. end
  140. end
  141.  
  142. for i = -0.8, 0.85, 1.6 do
  143. for x = -1, 1.1, 2 do
  144. local bah = Part(Mo, false, false, 0, 0, "Reddish brown", 0.45, 0.2, 1.1, true)
  145. Weld(main, bah, i, x, 0.5, 0, 0, 0)
  146. end
  147. for x = -20, 20, 5 do
  148. local p = Part(Mo, false, false, 0, 0, "Reddish brown", 0.45, 0.4, 0.2, true)
  149. local wa = Weld(main, p, 0, 0, 0, 0, 0, 0)
  150. wa.C0 = CFrame.new(i,0,1.2) * CFrame.Angles(math.rad(x),0,0)
  151. wa.C1 = CFrame.new(0,0,2.4)
  152. end
  153. end
  154.  
  155. for i = 90, -91, -180 do
  156. local pock = Part(Mo, false, false, 0, 0, "Reddish brown", 0.7, 0.8, 0.3, true)
  157. local wa = Weld(main, pock, 0, 0, 0, 0, 0, 0)
  158. wa.C0 = CFrame.new(0, -0.1, 0.5) * CFrame.Angles(0, math.rad(i), 0)
  159. wa.C1 = CFrame.new(0, 0, 1)
  160. local pock2 = Part(Mo, false, false, 0, 0, "Reddish brown", 0.8, 0.4, 0.4, true)
  161. Weld(pock, pock2, 0, -0.25, 0, 0, 0, 0)
  162. local shin = Part(Mo, false, false, 0, 0.05, "Bright yellow", 0.4, 0.2, 0.2, true)
  163. Weld(pock2, shin, 0, -0.06, 0.15, 0, 0, 0)
  164. Add.Sphere(shin)
  165. end
  166. local lastpart = nil
  167.  
  168. for i = -120, 0, 20 do
  169. local p = Part(Mo, false, false, 0, 0, "Reddish brown", 2, 0.47, 0.2, true)
  170. local wa = Weld(main, p, 0, 0, 0, 0, 0, 0)
  171. wa.C0 = CFrame.new(0,0.23,0.5) * CFrame.Angles(math.rad(i),0,0)
  172. wa.C1 = CFrame.new(0,0,-0.9)
  173. lastpart = p
  174. end
  175.  
  176. shiny = Part(Mo, false, false, 0, 0.05, "Bright yellow", 0.5, 0.3, 0.2, true)
  177. Weld(lastpart, shiny, 0, 0, -0.07, 0, 0, 0)
  178.  
  179.  
  180. RABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  181. LABrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  182. RLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  183. LLBrick = Part(Mo, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  184.  
  185. RABW = Weld(torso, RABrick, -1.5, -0.5, 0, 0, 0, 0)
  186. LABW = Weld(torso, LABrick, 1.5, -0.5, 0, 0, 0, 0)
  187. RLBW = Weld(torso, RLBrick, -0.5, 1, 0, 0, 0, 0)
  188. LLBW = Weld(torso, LLBrick, 0.5, 1, 0, 0, 0, 0)
  189.  
  190. RAW = Weld(RABrick, nil, 0, 0.5, 0, 0, 0, 0)
  191. LAW = Weld(LABrick, nil, 0, 0.5, 0, 0, 0, 0)
  192. RLW = Weld(RLBrick, nil, 0, 1, 0, 0, 0, 0)
  193. LLW = Weld(LLBrick, nil, 0, 1, 0, 0, 0, 0)
  194.  
  195. Mo.Parent = char
  196.  
  197. RAWBattle = nil
  198. LAWBattle = nil
  199.  
  200. for i=1,6 do
  201. local pew = Instance.new("Model",workspace)
  202. pew.Name = "Trash"
  203. local tr = Instance.new("IntValue",pew)
  204. tr.Value = 1
  205. tr.Name = "Throwable"
  206. local dm = Instance.new("IntValue",tr)
  207. dm.Value = 15
  208. dm.Name = "Dmg"
  209. local bah = Part(pew, false, true, 0, 0, "Brown", 1, 1, 1, true)
  210. bah.Position = Vector3.new(0, 20, 0)
  211. end
  212.  
  213. function SelectAnim()
  214. RAW.Part1 = Rarm
  215. LAW.Part1 = Larm
  216. for i=0,16,2 do
  217. RAW.C0 = CFrame.Angles(0,0,math.rad(i))
  218. LAW.C0 = CFrame.Angles(0,0,math.rad(-i))
  219. wait()
  220. end
  221. if RAWBattle == nil then
  222. RAWBattle = RAW.C0
  223. LAWBattle = LAW.C0
  224. end
  225. end
  226.  
  227. function DeselectAnim()
  228. for i=16,0,-2 do
  229. RAW.C0 = CFrame.Angles(0,0,math.rad(i))
  230. LAW.C0 = CFrame.Angles(0,0,math.rad(-i))
  231. wait()
  232. end
  233. RAW.Part1 = nil
  234. LAW.Part1 = nil
  235. end
  236.  
  237. function grab(targ, mouse)
  238. if able and targ.Parent:findFirstChild("Throwable") then
  239. able = false
  240. local blah = true
  241. local pos = nil
  242. mouse.Button1Down:connect(function()
  243. if blah == true then
  244. blah = false
  245. end
  246. end)
  247. coroutine.resume(coroutine.create(function()
  248. wait(4)
  249. blah = false
  250. end))
  251. repeat
  252. wait()
  253. pos = CFrame.new(torso.Position, targ.Position)
  254. pos = pos * CFrame.new(0,0,-(torso.Position - targ.Position).magnitude + targ.Size.X/2 + 1).p
  255. hum:MoveTo(pos, targ)
  256. if blah == false then
  257. break
  258. end
  259. until (torso.Position - pos).magnitude < 5
  260. hum:MoveTo(torso.Position, torso)
  261. if blah then
  262. local bp = Add.BP(torso)
  263. bp.position = pos
  264. local cf = ComputePos(torso.Position, pos)
  265. local bg = Add.BG(torso)
  266. bg.cframe = cf
  267. RLW.Part1 = Rleg
  268. LLW.Part1 = Lleg
  269. hum.PlatformStand = true
  270. for i=0, 70, 8 do
  271. bg.cframe = ComputePos(torso.Position, pos) * CFrame.Angles(math.rad(-i/1.4), 0, 0)
  272. RLW.C0 = CFrame.Angles(math.rad(i/1.4), 0, math.rad(i/4))
  273. LLW.C0 = CFrame.Angles(math.rad(i/1.4), 0, math.rad(-i/4))
  274. RAW.C0 = RAWBattle * CFrame.Angles(math.rad(i*1.3), 0, math.rad(-i/1.7)) * CFrame.new(0, -i/80, 0)
  275. LAW.C0 = LAWBattle * CFrame.Angles(math.rad(i*1.3), 0, math.rad(i/1.7)) * CFrame.new(0, -i/80, 0)
  276. wait()
  277. end
  278. local w = Weld(Rarm, targ, 0, 1.2, 0, math.random(-15,15)/10, math.random(-15,15)/10, math.random(-15,15)/10)
  279. ball = {targ, w}
  280. targ.CanCollide = false
  281. wait(0.1)
  282. for i=70, 0, -8 do
  283. bg.cframe = ComputePos(torso.Position, pos) * CFrame.Angles(math.rad(-i/1.4), 0, 0)
  284. RLW.C0 = CFrame.Angles(math.rad(i/1.4), 0, math.rad(i/4))
  285. LLW.C0 = CFrame.Angles(math.rad(i/1.4), 0, math.rad(-i/4))
  286. RAW.C0 = RAWBattle * CFrame.Angles(math.rad(i*1.3), 0, math.rad(-i/1.7)) * CFrame.new(0, -i/80, 0)
  287. LAW.C0 = LAWBattle * CFrame.Angles(math.rad(i*1.3), 0, math.rad(i/1.7)) * CFrame.new(0, -i/80, 0)
  288. wait()
  289. end
  290. hum.PlatformStand = false
  291. LLW.Part1 = nil
  292. RLW.Part1 = nil
  293. bp:remove()
  294. bg:remove()
  295. end
  296. able = true
  297. end
  298. end
  299.  
  300. function throw(Mousepos)
  301. if able then
  302. able = false
  303. local torsopos = torso.CFrame
  304. local bgcf = ComputePos(torsopos.p, Mousepos)
  305. local bg = Add.BG(torso)
  306.  
  307. local bp = Add.BP(torso)
  308. bp.position = torsopos.p
  309.  
  310. RLW.Part1 = Rleg
  311. LLW.Part1 = Lleg
  312. for i=0,-90,-90/4 do
  313. bg.cframe = bgcf * CFrame.Angles(0,math.rad(i),0)
  314. RAW.C0 = RAWBattle * CFrame.Angles(0,0,math.rad(-i/1.7))
  315. LAW.C0 = LAWBattle * CFrame.Angles(0,0,math.rad(i/1.9))
  316. neck.C0 = necko * CFrame.Angles(0,0,math.rad(-i))
  317. RLW.C0 = CFrame.Angles(0,0,math.rad(-i/4.5))
  318. LLW.C0 = CFrame.Angles(0,0,math.rad(i/4.5))
  319. wait()
  320. end
  321. wait(0.08)
  322. for i = 0, 90, 90/3 do
  323. bg.cframe = bgcf * CFrame.Angles(0,math.rad(i-90),0)
  324. RAW.C0 = RAWBattle * CFrame.Angles(0,0,math.rad(i-(-90/1.7)))
  325. neck.C0 = necko * CFrame.Angles(0,0,math.rad(-i+90))
  326. RLW.C0 = CFrame.Angles(0,0,math.rad(-(i/4.5)-(-90/4.5)))
  327. LLW.C0 = CFrame.Angles(0,0,math.rad((i/4.5)-(90/4.5)))
  328. wait()
  329. end
  330. throwsound:play()
  331. coroutine.resume(coroutine.create(function()
  332. local ta = ball
  333. ta[1].Parent.Parent = workspace
  334. ta[2]:remove()
  335. local c = CFrame.new(ball[1].Position, Mousepos) * CFrame.Angles(math.pi/8.5,0,0)
  336. local mag = (torsopos.p - Mousepos).magnitude
  337. mag = mag-(mag/5)
  338. if mag > 50 then mag = 50 end
  339. local kert = (40+(mag*2))
  340. ta[1].Velocity = c.lookVector * kert
  341. wait()
  342. ta[1].Velocity = c.lookVector * kert
  343. ta[1].CanCollide = true
  344. local abletohit = true
  345. ta[1].Touched:connect(function(hit)
  346. if hit.Parent ~= char and hit.Parent.Parent ~= char and abletohit then
  347. abletohit = false
  348. local pz = ta[1].Position
  349. local bla = Part(workspace, true, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  350. bla.CFrame = CFrame.new(pz)
  351. local saa = hitsound:clone()
  352. saa.Parent = bla
  353. saa:play()
  354. local toz = GetNoobs(pz, Dist)
  355. for i,v in pairs(toz) do
  356. if ta[1].Throwable:findFirstChild("Dmg") ~= nil then
  357. v[3].Value = v[3].Value - ta[1].Throwable.Dmg.Value
  358. end
  359. local caa = CFrame.new(pz, v[1].Position)
  360. v[1].Velocity = caa.lookVector * 25
  361. end
  362. coroutine.resume(coroutine.create(function()
  363. wait(0.5)
  364. bla:remove()
  365. end))
  366. end
  367. end)
  368. end))
  369. for i = 90, 180, 90/3 do
  370. bg.cframe = bgcf * CFrame.Angles(0,math.rad(i-90),0)
  371. RAW.C0 = RAWBattle * CFrame.Angles(0,0,math.rad(-i-(180/1.7)))
  372. neck.C0 = necko * CFrame.Angles(0,0,math.rad(-i+90))
  373. RLW.C0 = CFrame.Angles(0,0,math.rad((i/4.5)+(-90/4.5)))
  374. LLW.C0 = CFrame.Angles(0,0,math.rad(-(i/4.5)+(90/4.5)))
  375. wait()
  376. end
  377. wait(0.16)
  378. for i = 180, 90, -90/6 do
  379. bg.cframe = bgcf * CFrame.Angles(0,math.rad(i-90),0)
  380. RAW.C0 = RAWBattle * CFrame.Angles(0,0,math.rad(i-90))
  381. neck.C0 = necko * CFrame.Angles(0,0,math.rad(-i+90))
  382. LAW.C0 = LAWBattle * CFrame.Angles(0,0,math.rad(-i/1.9+(90/1.9)))
  383. RLW.C0 = CFrame.Angles(0,0,math.rad((i/4.5)+(-90/4.5)))
  384. LLW.C0 = CFrame.Angles(0,0,math.rad(-(i/4.5)+(90/4.5)))
  385. wait()
  386. end
  387. wait(0.06)
  388. bg:remove()
  389. bp:remove()
  390. RLW.Part1 = nil
  391. LLW.Part1 = nil
  392. RAW.C0 = RAWBattle
  393. LAW.C0 = LAWBattle
  394. neck.C0 = necko
  395. ball = nil
  396. able = true
  397. end
  398. end
  399.  
  400. function Select(mouse)
  401. SelectAnim()
  402. mouse.Button1Down:connect(function()
  403. if ball ~= nil then
  404. throw(mouse.Hit.p)
  405. else
  406. if mouse.Target ~= nil then
  407. grab(mouse.Target, mouse)
  408. end
  409. end
  410. end)
  411. end
  412.  
  413. function Deselect(mouse)
  414. DeselectAnim()
  415. end
  416.  
  417. if not script.Parent:IsA("HopperBin") then
  418. H = Instance.new("HopperBin",me.Backpack)
  419. H.Name = Modelname
  420. script.Parent = H
  421. end
  422.  
  423. bin = script.Parent
  424.  
  425. bin.Selected:connect(Select)
  426. bin.Deselected:connect(Deselect)
  427.  
  428. function givhp(cha)
  429. local hp = Instance.new("IntValue")
  430. hp.Value = 80
  431. hp.Name = "Hp"
  432. hp.Parent = cha
  433. local atc = true
  434. hp.Changed:connect(function()
  435. print(hp.Value)
  436. if hp.Value <= 0 and atc then
  437. atc = false
  438. hp.Value = 0
  439. local h, t = cha:findFirstChild("Humanoid"), cha:findFirstChild("Torso")
  440. local bp = nil
  441. local bg = nil
  442. if h ~= nil then
  443. h.PlatformStand = true
  444. end
  445. if t ~= nil then
  446. bp = Add.BP(t)
  447. bp.position = t.Position
  448. bg = Add.BG(t)
  449. bg.cframe = CFrame.new(Vector3.new(0, 20, 0), Vector3.new(0, 10, 0))
  450. end
  451. wait(11)
  452. hp.Value = 80
  453. if bp ~= nil then
  454. bp:remove()
  455. bg:remove()
  456. end
  457. if h ~= nil then
  458. h.PlatformStand = false
  459. end
  460. atc = true
  461. end
  462. end)
  463. end
  464.  
  465. for i,v in pairs(game.Players:GetPlayers()) do
  466. if v.Character then
  467. givhp(v.Character)
  468. v.CharacterAdded:connect(function(c)
  469. givhp(c)
  470. end)
  471. end
  472. end
  473. game.Players.PlayerAdded:connect(function(p)
  474. p.CharacterAdded:connect(function(c)
  475. givhp(c)
  476. end)
  477. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement