mathmasterphil

WaterbEnd

Mar 3rd, 2015
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.39 KB | None | 0 0
  1. local player=game.Players.LocalPlayer
  2. local character=player.Character
  3. local head=character["Head"]
  4. local torso=character["Torso"]
  5. local humanoid=character["Humanoid"]
  6. local arm={left=character["Left Arm"], right=character["Right Arm"]}
  7. local add={
  8. part=function(parent,anchored,cancollide,color,shape,t,size,cframe)
  9. local p=Instance.new("Part")
  10. p.Parent=parent
  11. p.TopSurface="Smooth"
  12. p.BottomSurface="Smooth"
  13. p.FormFactor="Custom"
  14. p.Anchored=anchored
  15. p.CanCollide=cancollide
  16. p.BrickColor=BrickColor.new(color)
  17. p.Shape=shape
  18. p.Transparency=t
  19. p.Size=size
  20. p.CFrame=cframe
  21. return p
  22. end,
  23. weld=function(parent,part1,cframe)
  24. local w=Instance.new("Weld")
  25. w.Parent=parent
  26. w.Part0=parent
  27. w.Part1=part1
  28. w.C1=cframe
  29. return w
  30. end,
  31. mesh=function(ins,parent,scale)
  32. local m=Instance.new(ins)
  33. m.Parent=parent
  34. m.Scale=scale
  35. return m
  36. end,
  37. sound=function(parent,volume,id)
  38. local s=Instance.new("Sound")
  39. s.Parent=parent
  40. s.Volume=volume
  41. s.SoundId=id
  42. return s
  43. end,
  44. model=function(parent,name)
  45. local m=Instance.new("Model")
  46. m.Parent=parent
  47. m.Name=name
  48. return m
  49. end,
  50. bg=function(parent,cframe)
  51. local g=Instance.new("BodyGyro")
  52. g.Parent=parent
  53. g.maxTorque=Vector3.new(math.huge,math.huge,math.huge)
  54. g.cframe=cframe
  55. return g
  56. end,
  57. bav=function(parent,angular)
  58. local av=Instance.new("BodyAngularVelocity")
  59. av.maxTorque=Vector3.new(math.huge,math.huge,math.huge)
  60. av.Parent=parent
  61. av.angularvelocity=angular
  62. return av
  63. end,
  64. bp=function(parent,pos)
  65. local p=Instance.new("BodyPosition")
  66. p.Parent=parent
  67. p.maxForce=Vector3.new(0,math.huge,0)
  68. p.position=pos
  69. return p
  70. end,
  71. bf=function(parent,force)
  72. local f=Instance.new("BodyForce")
  73. f.Parent=parent
  74. f.force=force
  75. return f
  76. end,
  77. humanoid=function(parent,maxhealth)
  78. local h=Instance.new("Humanoid")
  79. h.Parent=parent
  80. h.MaxHealth=maxhealth
  81. return h
  82. end
  83. }
  84. local c=function(f)coroutine.resume(coroutine.create(f))end
  85. local trailDeb=false
  86. local things=add.model(character,"Water Bending")
  87.  
  88. function computePos(pos1,pos2)
  89. local pos3=Vector3.new(pos2.x,pos1.y,pos2.z)
  90. return CFrame.new(pos1,pos3)
  91. end
  92.  
  93. local touchDeb=false
  94. function touch(hit)
  95. local human=hit.Parent:findFirstChild("Humanoid")
  96. local torso=hit.Parent:findFirstChild("Torso")
  97. if human and torso and human~=humanoid then
  98. local damage=math.random(5,10)
  99. c(function()
  100. human:TakeDamage(damage)
  101. human.PlatformStand=true
  102. torso.Velocity=torso.CFrame.lookVector*-150
  103. torso.RotVelocity=Vector3.new(math.random(-25,25),math.random(-25,25),math.random(-25,25))
  104. wait(1)
  105. human.PlatformStand=false
  106. torso.Velocity=Vector3.new(0,0,0)
  107. torso.RotVelocity=Vector3.new(0,0,0)
  108. end)
  109. end
  110. end
  111.  
  112. function trail(pos)
  113. trailDeb=true
  114. old=pos.Position
  115. c(function()
  116. while trailDeb==true do
  117. wait()
  118. new=pos.Position
  119. local magnitude=(old-new).magnitude
  120. local line=add.part(things,true,false,"Bright blue","Block",0,Vector3.new(8,8,8) ,CFrame.new(old,new)*CFrame.Angles(0,0,-magnitude/2))
  121. old=new
  122. c(function()
  123. for i=.2,1,.2 do
  124. wait()
  125. line.Transparency=i
  126. end
  127. line:remove()
  128. end)
  129. line.Touched:connect(touch)
  130. end
  131. end)
  132. end
  133.  
  134. local pathDeb=false
  135. local pathPart=nil
  136. local bPosition=10
  137. function path()
  138. pathDeb=true
  139. pathPart=add.part(things,true,true,"Bright blue","Block",0,Vector3.new(6,1,6),CFrame.new())
  140. local bp=add.bp(torso,torso.Position+Vector3.new(0,bPosition,0))
  141. while pathDeb==true do
  142. wait()
  143. pathPart.CFrame=torso.CFrame*CFrame.new(0,-4,0)
  144. end
  145. end
  146.  
  147. --Armz
  148. local fakeArm={left=add.part(things,false,false,"White","Block",1,Vector3.new(1,1,1),CFrame.new()), right=add.part(things,false,false,"White","Block",1,Vector3.new(1,1,1),CFrame.new())}
  149. local water={left=add.part(things,false,false,"Bright blue","Ball",1,Vector3.new(1,1,1),CFrame.new()), right=add.part(things,false,false,"Bright blue","Ball",1,Vector3.new(1,1,1),CFrame.new())}
  150. --Weldz
  151. local connectArmWeld={left=add.weld(torso,fakeArm.left,CFrame.new(1.5,-.5,0)), right=add.weld(torso,fakeArm.right,CFrame.new(-1.5,-.5,0))}
  152. local armWeld={left=add.weld(fakeArm.left,arm.left,CFrame.new(0,0.5,0)), right=add.weld(fakeArm.right,arm.right,CFrame.new(0,0.5,0))}
  153. local waterWeld={left=add.weld(water.left,arm.left,CFrame.new(0,-2,0)), right=add.weld(water.right,arm.right,CFrame.new(0,-2,0))}
  154.  
  155. local anim={
  156. equip=function()
  157. for i=.2,1,.2 do
  158. wait()
  159. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(45)*i)
  160. armWeld.right.C0=CFrame.Angles(math.rad(135)*i,0,0)
  161. end
  162. end,
  163. watershoot=function(mouse)
  164. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  165. trail(water.left)
  166. trail(water.right)
  167. local waterbull=add.part(things,false,false,"Bright blue","Ball",0,Vector3.new(6,6,6),CFrame.new((torso.CFrame+torso.CFrame.lookVector*5).p,mouse.hit.p))
  168. waterbull.Touched:connect(touch)
  169. waterbull.Velocity=waterbull.CFrame.lookVector*150
  170. trail(waterbull)
  171. local bf=add.bf(waterbull,Vector3.new(0,waterbull:GetMass()*196.2,0))
  172. for i=.2,1,.2 do
  173. wait()
  174. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(45)*i)
  175. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(45)*i)
  176. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  177. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  178. end
  179. wait(.2)
  180. for i=1,0,-.2 do
  181. wait()
  182. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(45)*i)
  183. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(45)*i)
  184. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  185. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  186. end
  187. game.Debris:AddItem(waterbull,5)
  188. trailDeb=false
  189. end,
  190. waterRaise=function(mouse)
  191. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  192. trail(water.left)
  193. trail(water.right)
  194. for i=.2,1,.2 do
  195. wait()
  196. armWeld.left.C0=CFrame.Angles(math.rad(135)*i,0,-math.rad(5)*i)
  197. armWeld.right.C0=CFrame.Angles(math.rad(135)*i,0,math.rad(5)*i)
  198. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  199. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  200. end
  201. wait(.2)
  202. for i=1,0,-.2 do
  203. wait()
  204. armWeld.left.C0=CFrame.Angles(math.rad(135)*i,0,-math.rad(5)*i)
  205. armWeld.right.C0=CFrame.Angles(math.rad(135)*i,0,math.rad(5)*i)
  206. waterWeld.left.C1=CFrame.new(0,-2+(-math.random(10,12)*i),0)
  207. waterWeld.right.C1=CFrame.new(0,-2+(-math.random(10,12)*i),0)
  208. end
  209. trailDeb=false
  210. end,
  211. waterSpin=function()
  212. trail(water.left)
  213. trail(water.right)
  214. local bg=add.bg(torso,torso.CFrame)
  215. for i=.2,1,.2 do
  216. wait()
  217. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(90)*i)
  218. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(90)*i)
  219. waterWeld.left.C1=CFrame.new(0,-2+(-math.random(5,8)*i),0)
  220. waterWeld.right.C1=CFrame.new(0,-2+(-math.random(5,8)*i),0)
  221. end
  222. local bav=add.bav(torso,Vector3.new(0,75,0))
  223. wait(3)
  224. for i=1,0,-.2 do
  225. wait()
  226. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(90)*i)
  227. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(90)*i)
  228. waterWeld.left.C1=CFrame.new(0,-2+(-5*i),0)
  229. waterWeld.right.C1=CFrame.new(0,-2+(-5*i),0)
  230. end
  231. bg:remove()
  232. bav:remove()
  233. trailDeb=false
  234. end,
  235. bend=function(mouse)
  236. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  237. trail(water.left)
  238. trail(water.right)
  239. for i=.2,1,.2 do
  240. wait()
  241. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(90)*i)
  242. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(90)*i)
  243. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  244. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  245. end
  246. wait(.2)
  247. for i=1,0,-.2 do
  248. wait()
  249. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(45)*i)
  250. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(45)*i)
  251. waterWeld.left.C1=CFrame.new(0,-2+(-15*i),0)
  252. waterWeld.right.C1=CFrame.new(0,-2+(-15*i),0)
  253. end
  254. trailDeb=false
  255. end,
  256. watershoot2=function(mouse)
  257. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  258. trail(water.left)
  259. trail(water.right)
  260. for i=1,40 do
  261. local waterbull=add.part(things,false,false,"Bright blue","Ball",0,Vector3.new(8,8,8),torso.CFrame*CFrame.Angles(0,math.rad(9)*i,0))
  262. waterbull.Velocity=waterbull.CFrame.lookVector*100
  263. trail(waterbull)
  264. local bf=add.bf(waterbull,Vector3.new(0,waterbull:GetMass()*196.2,0))
  265. game.Debris:AddItem(waterbull,5)
  266. waterbull.Touched:connect(touch)
  267. end
  268. for i=.2,1,.2 do
  269. wait()
  270. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(90)*i)
  271. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(90)*i)
  272. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  273. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  274. end
  275. wait(.2)
  276. for i=1,0,-.2 do
  277. wait()
  278. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(90)*i)
  279. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(90)*i)
  280. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  281. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  282. end
  283. trailDeb=false
  284. end,
  285. waterBack=function(mouse)
  286. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  287. trail(water.left)
  288. trail(water.right)
  289. for i=.2,1,.2 do
  290. wait()
  291. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,0)
  292. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,0)
  293. waterWeld.left.C1=CFrame.new(0,-2+(-20*i),0)
  294. waterWeld.right.C1=CFrame.new(0,-2+(-20*i),0)
  295. end
  296. wait(.2)
  297. for i=1,0,-.2 do
  298. wait()
  299. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,0)
  300. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,0)
  301. waterWeld.left.C1=CFrame.new(0,-2+(-20*i),0)
  302. waterWeld.right.C1=CFrame.new(0,-2+(-20*i),0)
  303. end
  304. trailDeb=false
  305. end,
  306. waterForward=function(mouse)
  307. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  308. torso.Anchored=true
  309. for i=.2,1,.2 do
  310. wait()
  311. armWeld.left.C0=CFrame.Angles(math.rad(135)*i,0,-math.rad(5)*i)
  312. armWeld.right.C0=CFrame.Angles(math.rad(135)*i,0,math.rad(5)*i)
  313. end
  314. for i=1,20 do
  315. wait()
  316. local waterblock=add.part(things,false,false,"Bright blue","Block",0,Vector3.new(4,4,4),torso.CFrame*CFrame.new(0,0,0)*CFrame.Angles(math.rad(45),0,0)+torso.CFrame.lookVector*2*i)
  317. trail(waterblock)
  318. game.Debris:AddItem(waterblock,1)
  319. waterblock.Touched:connect(touch)
  320. end
  321. wait(.2)
  322. torso.Anchored=false
  323. for i=1,0,-.2 do
  324. wait()
  325. armWeld.left.C0=CFrame.Angles(math.rad(135)*i,0,-math.rad(5)*i)
  326. armWeld.right.C0=CFrame.Angles(math.rad(135)*i,0,math.rad(5)*i)
  327. end
  328. trailDeb=false
  329. end
  330. }
  331.  
  332. function getTouched()
  333. for i,v in pairs(things:GetChildren()) do
  334. v.Touched:connect(touch)
  335. end
  336. end
  337.  
  338. local deb=false
  339. local buttonDeb=false
  340. local bin=Instance.new("HopperBin")
  341. bin.Parent=player.Backpack
  342. bin.Name="Water Bending"
  343. bin.Selected:connect(function(mouse)
  344. bin:remove()
  345. anim.equip()
  346. mouse.Button1Down:connect(function()
  347. if deb==false then
  348. deb=true
  349. getTouched()
  350. anim.watershoot(mouse)
  351. anim.equip()
  352. deb=false
  353. end
  354. end)
  355. mouse.KeyDown:connect(function(key)
  356. if key=="q" and deb==false then
  357. deb=true
  358. getTouched()
  359. anim.waterRaise(mouse)
  360. anim.equip()
  361. deb=false
  362. end
  363. if key=="e" and deb==false then
  364. deb=true
  365. getTouched()
  366. anim.waterSpin()
  367. anim.equip()
  368. deb=false
  369. end
  370. if key=="r" and deb==false then
  371. deb=true
  372. getTouched()
  373. anim.bend(mouse)
  374. anim.equip()
  375. deb=false
  376. end
  377. if key=="f" and deb==false then
  378. deb=true
  379. getTouched()
  380. anim.watershoot2(mouse)
  381. anim.equip()
  382. deb=false
  383. end
  384. if key=="g" and deb==false then
  385. deb=true
  386. getTouched()
  387. anim.waterBack(mouse)
  388. anim.equip()
  389. deb=false
  390. end
  391. if key=="h" and deb==false then
  392. deb=true
  393. getTouched()
  394. anim.waterForward(mouse)
  395. anim.equip()
  396. deb=false
  397. end
  398. if key=="z" and buttonDeb==false then
  399. buttonDeb=true
  400. getTouched()
  401. path()
  402. end
  403. if key=="z" and buttonDeb==true then
  404. buttonDeb=false
  405. pathPart:remove() torso["BodyPosition"]:remove()
  406. end
  407. end)
  408. end) --mediafire
Add Comment
Please, Sign In to add comment