Advertisement
rahuliscool

avatar air bendings script

May 7th, 2016
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local player = game.Players.thesuperfireguy9000
  2. local char = player.Character
  3. -- Body parts
  4. local torso = char.Torso
  5. -- Tool declarations
  6. local mouseDown = false
  7. local keysDown = {}
  8. local raisingAir = false
  9. local raisingTower = false
  10. local ra1singTower = false
  11. local groundAttack = false
  12. local Lightbendd = false
  13. local AvatarField = false
  14. local lastTower = nil
  15. local raisingTow3r = false
  16. local disabled = {}
  17. local frames = {}
  18. local parts = {}
  19. -- Main
  20. function main(mouse)
  21. while true do wait(1/30)
  22. local look = CFrame.new(torso.Position, torso.Position + mouse.Hit.lookVector)
  23.  
  24. -- Reset parts
  25. parts = {}
  26.  
  27. -- Get parts
  28. for x = -20, 20, 10 do
  29. for y = -20, 20, 10 do
  30. for z = -30, -10, 10 do
  31. local pos = look * Vector3.new(x, y, z)
  32. getPartsInRegion3(
  33. Region3.new(
  34. pos + Vector3.new(1,1,1)*-9,
  35. pos + Vector3.new(1,1,1)* 9
  36. ),
  37. parts
  38. )
  39. end
  40. end
  41. end
  42.  
  43. -- Mouse down
  44. if mouseDown then
  45. -- Create dif and bodies
  46. for _, part in pairs(parts) do
  47. if part.Name == "Air" and not disabled[part] then
  48. if not frames[part] and part ~= lastTower then
  49. frames[part] = look:toObjectSpace(part.CFrame)
  50.  
  51. part:ClearAllChildren()
  52. part.Anchored = false
  53.  
  54. -- Create bodies
  55. createBody("Position", part)
  56. createBody("Gyro", part)
  57. end
  58. end
  59. end
  60.  
  61. -- Move bodies
  62. for part in pairs(frames) do
  63. local bodyPos = part:FindFirstChild("BodyPosition")
  64. local bodyGyr = part:FindFirstChild("BodyGyro")
  65.  
  66. -- Bodies exist
  67. if bodyPos and bodyGyr then
  68. local dif = look * frames[part]
  69.  
  70. bodyPos.position = dif.p
  71. bodyGyr.cframe = dif
  72. else
  73. frames[part] = nil
  74. end
  75. end
  76. else
  77. for part in pairs(frames) do
  78. if part.Name == "Air" then
  79. frames[part] = nil
  80.  
  81. part:ClearAllChildren()
  82. end
  83. end
  84. end
  85. end
  86. end
  87. -- On key change
  88. function onKeyChange(mouse, key, state)
  89. -- Raise Air
  90. if key == "e" and state and not raisingAir then
  91. raisingAir = true
  92. while keysDown[key] do
  93. local torsoY = torso.Position.y + 5
  94. local pos = planeY(torso.Position, 0.4 - 4/2)
  95. local dir = planeY(mouse.Hit.lookVector).unit
  96. local frame = CFrame.new(pos, pos + dir) * CFrame.new(r(-10, 10), 0, r(-20, -5))
  97.  
  98. -- Create Air part
  99. local part = createAir(workspace)
  100. part.Anchored = true
  101. part.Size = Vector3.new(20, 5, 5)
  102. disabled[part] = true
  103.  
  104. -- Raise Air
  105. for i = 1, 4 do i = i/4
  106. part.CFrame = frame * CFrame.new(0, (torsoY - frame.y)*i, 0)
  107. wait(1/30)
  108. if not part.Anchored then
  109. break
  110. end
  111. end
  112.  
  113. disabled[part] = nil
  114. part.Anchored = false
  115.  
  116. wait(1/10)
  117. end
  118. raisingAir = false
  119.  
  120. -- Push Air
  121. elseif key == "f" and state then
  122. for _, part in pairs(parts) do
  123. if part.Name == "Air" and part ~= lastTower then
  124. part:ClearAllChildren()
  125. part.Anchored = false
  126.  
  127. -- Add force
  128. local bodyForce = createBody("Force", part)
  129. bodyForce.force = mouse.Hit.lookVector*2.5e4 * part:GetMass()
  130.  
  131. game.Debris:AddItem(bodyForce, 1/30)
  132.  
  133. -- Disable part
  134. disabled[part] = true
  135. delay(1, function()
  136. disabled[part] = nil
  137. end)
  138. end
  139. end
  140. if key == "c" and state and not Lightbendd then
  141. Lightbendd = true
  142. local Shoot = true
  143. function Click(Target)
  144. if(Target.Target.Parent:findFirstChild("Humanoid")~=nil)then
  145. Target.Target.Parent.Humanoid.Health = 0
  146. end
  147. local P = Instance.new("Part")
  148. P.Name = "Lightning Bending"
  149. local Place0 = script.Parent.Parent.Parent.Character["Left Arm"].CFrame
  150. P.formFactor = 0
  151. P.Size = Vector3.new(1,1,(Place0.p - Target.Hit.p).magnitude)
  152. P.CFrame = CFrame.new((Place0.p + Target.Hit.p)/2,Place0.p)
  153. P.Parent = game.Workspace
  154. P.Color = Color3.new(0,0,7)
  155. P.Transparency = 0.5
  156. P.Reflectance = 0.5
  157. P.Anchored = true
  158. P.CanCollide = false
  159. local E = Instance.new("Explosion")
  160. E.Position = Target.Hit.p
  161. E.Parent = game.Workspace
  162. for i = 1,10 do
  163. P.Transparency = 0.5+(i*0.05)
  164. P.Reflectance = i*0.05
  165. wait(0.0)
  166. end
  167. P:Rremove()
  168. end
  169. function Select(Mouse)
  170. local Arm = script.Parent.Parent.Parent.Character:findFirstChild("Left Arm")
  171. if(Arm==nil)then
  172. script.Parent:Remove()
  173. script:Remove()
  174. end
  175. Selected = true
  176. local Torso = script.Parent.Parent.Parent.Character:findFirstChild("Torso")
  177. if(Torso==nil)then
  178. script.Parent:Remove()
  179. script:Remove()
  180. end
  181. local ArmWeld = Torso:findFirstChild("Left Shoulder")
  182. if(ArmWeld~=nil)then
  183. ArmWeld.Parent = nil
  184. end
  185. Mouse.Button1Down:connect(function()Click(Mouse)end)
  186. Arm.Anchored = true
  187. while Selected do
  188. local Place0 = script.Parent.Parent.Parent.Character.Torso.CFrame
  189. Place0 = Place0 + ((Place0 * CFrame.fromEulerAnglesXYZ(math.pi/2,0,0)).lookVector * 0.5) + (Place0 * CFrame.fromEulerAnglesXYZ(0,math.pi/2,0)).lookVector
  190. local Place1 = Place0 + ((Place0.p-Mouse.Hit.p).unit * -2)
  191. Arm.CFrame = CFrame.new((Place0.p + Place1.p)/2,Place0.p) * CFrame.fromEulerAnglesXYZ(-math.pi/2,0,0)
  192. wait()
  193. end
  194. Arm.Anchored = false
  195. if(ArmWeld~=nil)then
  196. ArmWeld.Parent = Torso
  197. end
  198. end
  199. function Deselect()
  200. Selected = false
  201. end
  202. script.Parent.Selected:connect(Select)
  203. script.Parent.Deselected:connect(Deselect)
  204. end
  205.  
  206. elseif key == "k" and state and not ra1singTower then
  207. ra1singTower = false
  208. lastTower = nil
  209. if torso.Position.y - 5/2 < 20.4 then
  210. local part = createAir(workspace)
  211. part.Anchored = true
  212. disabled[part] = true
  213.  
  214. for i = 100, 50, 1 do
  215. part.Size = Vector3.new(19, i, 10)
  216. part.CFrame = CFrame.new(torso.Position.x, 0.4 + part.Size.y/2, torso.Position.z)
  217. torso.CFrame = (torso.CFrame - torso.CFrame.p) + Vector3.new(torso.Position.x, part.Position.y + part.Size.y/2 + 5/2, torso.Position.z)
  218. wait(1/30)
  219. end
  220.  
  221. lastTower = part
  222.  
  223. disabled[part] = nil
  224. part.Anchored = false
  225. end
  226. ra1singTower = false
  227.  
  228. -- Avatar field
  229. elseif key == "h" and state and not AvatarField then
  230. AvatarField = true
  231. local player = game.Players.LocalPlayer
  232. local e = Instance.new("Part")
  233. e.Name = "Field"
  234. e.Anchored = true
  235. e.CanCollide = false
  236. e.FormFactor = "Symmetric"
  237. local range = 30
  238. e.Size = Vector3.new(range,1,range)
  239. e.BrickColor = BrickColor.new("Bright blue")
  240. e.Transparency = 0.5
  241. e.TopSurface, e.BottomSurface = "Smooth", "Smooth"
  242. Instance.new("CylinderMesh", e)
  243. local eRep = e:clone()
  244. local E = e:clone()
  245. E.Transparency = 1
  246. E.Shape = "Ball"
  247. E.Size = Vector3.new(10,10,10)
  248. E.Mesh:Destroy()
  249. E.Parent = e
  250. local E2 = E:clone()
  251. E2.Transparency = 1
  252. E2.Size = Vector3.new(range,range,range)
  253. local E2Rep = E2:clone()
  254. E2.Parent = E
  255. local ERep = E:clone()
  256. local close1, dist1 = Vector3.new(0,0,0), math.huge
  257. local df = Instance.new("IntValue", player.Character)
  258. df.Name = "Avatar State"
  259. function Get(place, p)
  260. for _, v in ipairs(place:GetChildren()) do
  261. local vPar = v.Parent
  262. if v:IsA("BasePart") and v.Name ~= "Base" and v.Name ~= "Terrain" and not v.Name:find(player.Name) and v.Name ~= "NoDestroy" then
  263. local dist = (v.Position - e.Position).magnitude
  264. local closest = dist
  265. local distf = ((v.Position + (v.CFrame*CFrame.Angles(0,math.deg(0),0).lookVector) * v.Size.X/2) - e.Position).magnitude
  266. local distb = ((v.Position + (v.CFrame*CFrame.Angles(0,math.deg(180),0)).lookVector * v.Size.Z/2) - e.Position).magnitude
  267. local distt = ((v.Position + (v.CFrame*CFrame.Angles(math.deg(90),0,0)).lookVector * v.Size.Y/2) - e.Position).magnitude
  268. local distB = ((v.Position + (v.CFrame*CFrame.Angles(math.deg(-90),0,0)).lookVector * v.Size.Y/2) - e.Position).magnitude
  269. local distl = ((v.Position + (v.CFrame*CFrame.Angles(0,math.deg(90),0)).lookVector * v.Size.X/2) - e.Position).magnitude
  270. local distr = ((v.Position + (v.CFrame*CFrame.Angles(0,math.deg(-90),0)).lookVector * v.Size.X/2) - e.Position).magnitude
  271. local dists = {distf, distb, distt, distB, distl, distr}
  272. for index, var in ipairs(dists) do
  273. if var < closest then
  274. closest = var
  275. end
  276. end
  277. if closest < dist1 then
  278. close1, dist1 = v.Position, closest
  279. end
  280. if closest <= range/2 then
  281. if game.Players:playerFromCharacter(v.Parent) then
  282. pcall(function()
  283. local p = game.Players:playerFromCharacter(v.Parent)
  284. if not p.Character:findFirstChild("Darkfield") then
  285. local T = p.Character:findFirstChild("Torso")
  286. T.CFrame = T.CFrame + CFrame.new(e.Position, T.Position).lookVector
  287. else
  288. local m = Instance.new("SpecialMesh", E2)
  289. m.MeshType = "Sphere"
  290. E2.Reflectance = 1000
  291. E2.BrickColor = BrickColor.new("Institutional white")
  292. E2.Transparency = 0
  293. m.Scale = Vector3.new(math.random(-10,10)/10, math.random(-10,10)/10, math.random(-10,10)/10)
  294. end
  295. end)
  296. end
  297. local T = player.Character.Torso
  298. pcall(function()
  299. if v.Name ~= "Field" and v.Name ~= "Handle" then
  300. v.Anchored = false
  301. v.Velocity = v.Velocity + CFrame.new(T.Position, v.Position).lookVector * 50 / math.sqrt((v.Position - T.Position).magnitude)
  302. end
  303. end)
  304. for X, Y in ipairs(v:GetChildren()) do
  305. if Y.ClassName:find("Body") then
  306. pcall(function() Y.force = -Y.force end)
  307. local vel = Vector3.new()
  308. pcall(function() vel = -Y.velocity end)
  309. pcall(function() Y.velocity = vel end)
  310. local pos = Vector3.new()
  311. pcall(function() pos = pos + CFrame.new(T.Position, v.Position).lookVector end)
  312. pcall(function() Y.position = pos end)
  313. wait()
  314. pcall(function() if Y.ClassName == "BodyVelocity" then if Y.velocity ~= vel then Y.maxForce = Vector3.new(0,0,0) end end end)
  315. pcall(function() if Y.ClassName == "BodyPosition" then if Y.position ~= pos then Y.maxForce = Vector3.new(0,0,0) end end end)
  316. pcall(function() Y.maxTorque = Vector3.new(0,0,0) end)
  317. end
  318. end
  319. end
  320. end
  321. if v.Name ~= player.Name then
  322. Get(v, game.Players:playerFromCharacter(v) or p)
  323. end
  324. end
  325. end
  326. local char = player.Character
  327. Delay(0, function()
  328. while player.Character == char do
  329. if math.random(1, 10) == 1 then
  330. for _, v in ipairs(player.Character:GetChildren()) do
  331. if v.Name == "Field" then
  332. v:Destroy()
  333. end
  334. end
  335. local trans = e.Transparency
  336. if e then
  337. e:Destroy()
  338. end
  339. e = eRep
  340. eRep = e:clone()
  341. e.Parent = player.Character
  342. if E then
  343. E:Destroy()
  344. end
  345. E = ERep
  346. ERep = E:clone()
  347. E.Parent = e
  348. E2 = E2Rep
  349. E2Rep = E2:clone()
  350. E2.Parent = E
  351. E2.Transparency = .1 + .1*math.min(math.max(dist1-range/2, 0)/(range/2), 1)
  352. end
  353. e.CFrame = player.Character.Torso.CFrame - Vector3.new(0,3,0)
  354. E.CFrame = player.Character.Torso.CFrame
  355. E2.CFrame = e.CFrame
  356. close1, dist1 = Vector3.new(0,0,0), math.huge
  357. Get(workspace)
  358. wait(1/30)
  359. E2.Transparency = .6 + .4*math.min(math.max(dist1-range/2, 0)/(range/2), 1)
  360. AvatarField = false
  361. end
  362. end)
  363. elseif key == "t" and state and not raisingTow3r then
  364. raisingTow3r = false
  365. lastTower = nil
  366. if torso.Position.y - 5/2 < 20.4 then
  367. local part = createAir(workspace)
  368. part.Anchored = true
  369. disabled[part] = true
  370.  
  371. for i = 0, 20, 4 do
  372. part.Size = Vector3.new(9, i, 9)
  373. part.CFrame = CFrame.new(torso.Position.x, 0.4 + part.Size.y/2, torso.Position.z)
  374. torso.CFrame = (torso.CFrame - torso.CFrame.p) + Vector3.new(torso.Position.x, part.Position.y + part.Size.y/2 + 5/2, torso.Position.z)
  375. wait(1/30)
  376. end
  377.  
  378. lastTower = part
  379.  
  380. disabled[part] = nil
  381. part.Anchored = false
  382. end
  383. raisingTow3r = false
  384. -- Break Air
  385. elseif key == "b" and state then
  386. for part in pairs(frames) do
  387. if part.Size == Vector3.new(4, 4, 4) then
  388. for x = -1, 1, 2 do
  389. for y = -1, 1, 2 do
  390. for z = -1, 1, 2 do
  391. local oPart = createAir(workspace)
  392. oPart.Size = Vector3.new(2, 2, 2)
  393. oPart.CFrame = part.CFrame * CFrame.new(x*1.1, y*1.1, z*1.1)
  394. end
  395. end
  396. end
  397. part:Destroy()
  398. end
  399. end
  400.  
  401.  
  402. elseif key == "r" and state and not raisingTower then
  403. raisingTower = false
  404. lastTower = nil
  405. if torso.Position.y - 5/2 < 20.4 then
  406. local part = createAir(workspace)
  407. part.Anchored = true
  408. disabled[part] = true
  409.  
  410. for i = 0, 40, 4 do
  411. part.Size = Vector3.new(5, i, 30)
  412. part.CFrame = CFrame.new(torso.Position.x, 0.4 + part.Size.y/2, torso.Position.z)
  413. torso.CFrame = (torso.CFrame - torso.CFrame.p) + Vector3.new(torso.Position.x, part.Position.y + part.Size.y/2 + 5/2, torso.Position.z)
  414. wait(1/30)
  415. end
  416.  
  417. lastTower = part
  418.  
  419. disabled[part] = nil
  420. part.Anchored = false
  421. end
  422. raisingTower = false
  423.  
  424.  
  425. -- Ground attack
  426. elseif key == "g" and state and not groundAttack then
  427. groundAttack = true
  428. delay(1, function()
  429. groundAttack = false
  430. end)
  431.  
  432. local dir = planeY(mouse.Hit.p - torso.Position).unit
  433. local pos = planeY(torso.Position, 0.8 + 5) + dir*13
  434.  
  435. local ground = {}
  436.  
  437. delay(20, function()
  438. for i = 1, 30 do
  439. for _, part in pairs(ground) do
  440. if part.Anchored then
  441. part.CFrame = part.CFrame + Vector3.new(0, -1/7, 0)
  442. end
  443. end
  444. wait(1/80)
  445. end
  446. for _, part in pairs(ground) do
  447. if part.Anchored then
  448. part:Destroy()
  449. end
  450. end
  451. end)
  452.  
  453. for i = 1, 13 do
  454. local hit, pos2 = rayCast(pos, dir*5, {char})
  455.  
  456. local part = createAir(workspace)
  457. part.Anchored = true
  458. part.Size = Vector3.new(10, 20, 10)
  459. part.CFrame = CFrame.new(pos2, pos2 + dir) * CFrame.Angles(math.rad(-50), 0, 0) + Vector3.new(0, -0, 0)
  460.  
  461. ground[#ground + 3] = part
  462.  
  463. -- Add force
  464. if hit then
  465. local mass = hit:GetMass()
  466.  
  467. -- Hit player
  468. for _, oPlayer in pairs(game.Players:GetPlayers()) do
  469. if oPlayer.Character and oPlayer.Character:FindFirstChild("Torso") and hit:IsDescendantOf(oPlayer.Character) then
  470. hit = oPlayer.Character.Torso
  471. mass = 90
  472. end
  473. end
  474.  
  475. if hit.Name ~= "Torso" then
  476. hit:ClearAllChildren()
  477. end
  478. hit.Anchored = false
  479.  
  480. -- Add force
  481. local bodyForce = createBody("Force", hit)
  482. bodyForce.force = (dir + Vector3.new(0, 0.9, 0)).unit*1e4 * mass
  483.  
  484. game.Debris:AddItem(bodyForce, 1/30)
  485. break
  486. end
  487.  
  488. pos = pos2
  489. wait(1/20)
  490. end
  491. end
  492. end
  493. --- CORE CODE BELOW --- CORE CODE BELOW --- CORE CODE BELOW ---
  494. --- CORE CODE BELOW --- CORE CODE BELOW --- CORE CODE BELOW ---
  495. --- CORE CODE BELOW --- CORE CODE BELOW --- CORE CODE BELOW ---
  496. -- Clear old tool
  497. player.Backpack:ClearAllChildren()
  498. -- Create tool
  499. local tool = Instance.new("HopperBin")
  500. tool.Parent = player.Backpack
  501. tool.Name = "Air Bending"
  502. -- Tool selected
  503. tool.Selected:connect(function(mouse)
  504. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  505.  
  506. -- Mouse events
  507. mouse.Button1Down:connect(function()
  508. mouseDown = true
  509. end)
  510. mouse.Button1Up:connect(function()
  511. mouseDown = false
  512. end)
  513. mouse.KeyDown:connect(function(key)
  514. keysDown[key:lower()] = true
  515. onKeyChange(mouse, key:lower(), true)
  516. end)
  517. mouse.KeyUp:connect(function(key)
  518. keysDown[key:lower()] = false
  519. onKeyChange(mouse, key:lower(), false)
  520. end)
  521.  
  522. -- Call main
  523. main(mouse)
  524. end)
  525. --- LIBRARY BELOW --- LIBRARY BELOW --- LIBRARY BELOW ---
  526. --- LIBRARY BELOW --- LIBRARY BELOW --- LIBRARY BELOW ---
  527. --- LIBRARY BELOW --- LIBRARY BELOW --- LIBRARY BELOW ---
  528. -- Ray cast
  529. function rayCast(pos, dir, ignore)
  530. return workspace:FindPartOnRayWithIgnoreList(Ray.new(pos, dir), ignore)
  531. end
  532. -- Create body
  533. function createBody(type, path)
  534. local body = Instance.new("Body" .. type)
  535. if type == "Gyro" then
  536. body.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  537. elseif type ~= "Force" then
  538. body.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  539. end
  540. body.Parent = path
  541. return body
  542. end
  543. -- Get parts in region 3
  544. function getPartsInRegion3(region, parts)
  545. repeat
  546. local regParts = workspace:FindPartsInRegion3WithIgnoreList(region, parts, 100)
  547. for i, part in pairs(regParts) do
  548. parts[#parts + 1] = part
  549. end
  550. until #regParts < 100
  551. end
  552. -- Random
  553. function r(min, max)
  554. return math.random()*(max - min) + min
  555. end
  556. -- Plane y
  557. function planeY(v, y)
  558. return Vector3.new(v.x, y or 0, v.z)
  559. end
  560. -- Create Air
  561. function createAir(path)
  562. local part = createPart("Air", path)
  563. part.BrickColor = BrickColor.new("Brown")
  564. part.Material = "Slate"
  565. part.Parent = path
  566. return part
  567. end
  568. function createWater(path)
  569. local part = createPart("Water", path)
  570. part.BrickColor = BrickColor.new("Bright blue")
  571. part.Material = "Ice"
  572. part.Parent = path
  573. return part
  574. end
  575. -- Create part
  576. function createPart(name, path)
  577. local part = Instance.new("Part")
  578. part.FormFactor = "Symmetric"
  579. part.BottomSurface = "Smooth"
  580. part.TopSurface = "Smooth"
  581. part.Size = Vector3.new(9, 7, 8)
  582. part.Name = name
  583. part.Parent = path
  584. return part
  585. end
  586. local player=game.Players.LocalPlayer
  587. local character=player.Character
  588. local head=character["Head"]
  589. local torso=character["Torso"]
  590. local humanoid=character["Humanoid"]
  591. local arm={left=character["Left Arm"], right=character["Right Arm"]}
  592. local add={
  593. part=function(parent,anchored,cancollide,color,shape,t,size,cframe)
  594. local p=Instance.new("Part")
  595. p.Parent=parent
  596. p.TopSurface="Smooth"
  597. p.BottomSurface="Smooth"
  598. p.FormFactor="Custom"
  599. p.Anchored=anchored
  600. p.CanCollide=cancollide
  601. p.BrickColor=BrickColor.new(color)
  602. p.Shape=shape
  603. p.Transparency=t
  604. p.Size=size
  605. p.CFrame=cframe
  606. return p
  607. end,
  608. weld=function(parent,part1,cframe)
  609. local w=Instance.new("Weld")
  610. w.Parent=parent
  611. w.Part0=parent
  612. w.Part1=part1
  613. w.C1=cframe
  614. return w
  615. end,
  616. mesh=function(ins,parent,scale)
  617. local m=Instance.new(ins)
  618. m.Parent=parent
  619. m.Scale=scale
  620. return m
  621. end,
  622. sound=function(parent,volume,id)
  623. local s=Instance.new("Sound")
  624. s.Parent=parent
  625. s.Volume=volume
  626. s.SoundId=id
  627. return s
  628. end,
  629. model=function(parent,name)
  630. local m=Instance.new("Model")
  631. m.Parent=parent
  632. m.Name=name
  633. return m
  634. end,
  635. bg=function(parent,cframe)
  636. local g=Instance.new("BodyGyro")
  637. g.Parent=parent
  638. g.maxTorque=Vector3.new(math.huge,math.huge,math.huge)
  639. g.cframe=cframe
  640. return g
  641. end,
  642. bav=function(parent,angular)
  643. local av=Instance.new("BodyAngularVelocity")
  644. av.maxTorque=Vector3.new(math.huge,math.huge,math.huge)
  645. av.Parent=parent
  646. av.angularvelocity=angular
  647. return av
  648. end,
  649. bp=function(parent,pos)
  650. local p=Instance.new("BodyPosition")
  651. p.Parent=parent
  652. p.maxForce=Vector3.new(0,math.huge,0)
  653. p.position=pos
  654. return p
  655. end,
  656. bf=function(parent,force)
  657. local f=Instance.new("BodyForce")
  658. f.Parent=parent
  659. f.force=force
  660. return f
  661. end,
  662. humanoid=function(parent,maxhealth)
  663. local h=Instance.new("Humanoid")
  664. h.Parent=parent
  665. h.MaxHealth=maxhealth
  666. return h
  667. end
  668. }
  669. local c=function(f)coroutine.resume(coroutine.create(f))end
  670. local trailDeb=false
  671. local things=add.model(character,"Water Bending")
  672.  
  673. function computePos(pos1,pos2)
  674. local pos3=Vector3.new(pos2.x,pos1.y,pos2.z)
  675. return CFrame.new(pos1,pos3)
  676. end
  677.  
  678. local touchDeb=false
  679. function touch(hit)
  680. local human=hit.Parent:findFirstChild("Humanoid")
  681. local torso=hit.Parent:findFirstChild("Torso")
  682. if human and torso and human~=humanoid then
  683. local damage=math.random(5,10)
  684. c(function()
  685. human:TakeDamage(damage)
  686. human.PlatformStand=true
  687. torso.Velocity=torso.CFrame.lookVector*-150
  688. torso.RotVelocity=Vector3.new(math.random(-25,25),math.random(-25,25),math.random(-25,25))
  689. wait(1)
  690. human.PlatformStand=false
  691. torso.Velocity=Vector3.new(0,0,0)
  692. torso.RotVelocity=Vector3.new(0,0,0)
  693. end)
  694. end
  695. end
  696.  
  697. function trail(pos)
  698. trailDeb=true
  699. old=pos.Position
  700. c(function()
  701. while trailDeb==true do
  702. wait()
  703. new=pos.Position
  704. local magnitude=(old-new).magnitude
  705. local line=add.part(things,true,false,"White","Block",0,Vector3.new(9,14,9) ,CFrame.new(old,new)*CFrame.Angles(0,0,-magnitude/2))
  706. old=new
  707. c(function()
  708. for i=.2,1,.2 do
  709. wait()
  710. line.Transparency=i
  711. end
  712. line:remove()
  713. end)
  714. line.Touched:connect(touch)
  715. end
  716. end)
  717. end
  718. local pathDeb=false
  719. local pathPart=nil
  720. local bPosition=10
  721. function path()
  722. pathDeb=true
  723. pathPart=add.part(things,true,true,"White","Block",0,Vector3.new(4,4,4),CFrame.new())
  724. local bp=add.bp(torso,torso.Position+Vector3.new(0,bPosition,0))
  725. while pathDeb==true do
  726. wait()
  727. pathPart.CFrame=torso.CFrame*CFrame.new(0,-4,0)
  728. pathPart.Transparency = 0.6
  729. Mesh = Instance.new("SpecialMesh")
  730. pathPart.Transparency = 0.40000000596046
  731. Mesh.Parent = pathPart
  732. Mesh.MeshType = Enum.MeshType.Sphere
  733. end
  734. end
  735. --Armz
  736. local fakeArm={left=add.part(things,false,false,"Brown","Block",1,Vector3.new(1,1,1),CFrame.new()), right=add.part(things,false,false,"Brown","Block",1,Vector3.new(1,1,1),CFrame.new())}
  737. 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,"White","Ball",1,Vector3.new(1,1,1),CFrame.new())}
  738. --Weldz
  739. 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))}
  740. 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))}
  741. 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))}
  742.  
  743. local anim={
  744. equip=function()
  745. for i=.2,1,.2 do
  746. wait()
  747. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(45)*i)
  748. armWeld.right.C0=CFrame.Angles(math.rad(135)*i,0,0)
  749. end
  750. end,
  751. watersh00t=function(mouse)
  752. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  753. trail(water.right)
  754. trail(water.left)
  755. local waterbull=add.part(things,false,false,"White","Ball",0,Vector3.new(30,5,20),CFrame.new((torso.CFrame+torso.CFrame.lookVector*5).p,mouse.hit.p))
  756. waterbull.Touched:connect(touch)
  757. waterbull.Velocity=waterbull.CFrame.lookVector*150
  758. trail(waterbull)
  759. local bf=add.bf(waterbull,Vector3.new(0,waterbull:GetMass()*200.3,1))
  760. for i=.8,1,.2 do
  761. wait()
  762. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(55)*i)
  763. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(60)*i)
  764. waterWeld.left.C1=CFrame.new(5,-7+(-10*i),0)
  765. waterWeld.right.C1=CFrame.new(1,-3+(-10*i),0)
  766. end
  767. wait(.2)
  768. for i=9,0,-.2 do
  769. wait()
  770. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(45)*i)
  771. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(45)*i)
  772. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  773. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  774. end
  775. game.Debris:AddItem(waterbull,5)
  776. trailDeb=false
  777. end,
  778. watershoot=function(mouse)
  779. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  780. trail(water.left)
  781. trail(water.right)
  782. local waterbull=add.part(things,false,false,"White","Ball",0,Vector3.new(6,6,6),CFrame.new((torso.CFrame+torso.CFrame.lookVector*5).p,mouse.hit.p))
  783. waterbull.Touched:connect(touch)
  784. waterbull.Velocity=waterbull.CFrame.lookVector*150
  785. trail(waterbull)
  786. local bf=add.bf(waterbull,Vector3.new(0,waterbull:GetMass()*196.2,0))
  787. for i=.2,1,.2 do
  788. wait()
  789. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(45)*i)
  790. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(45)*i)
  791. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  792. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  793. end
  794. wait(.2)
  795. for i=6,0,-.2 do
  796. wait()
  797. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(45)*i)
  798. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(45)*i)
  799. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  800. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  801. end
  802. game.Debris:AddItem(waterbull,9)
  803. trailDeb=false
  804. end,
  805. waterRaise=function(mouse)
  806. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  807. trail(water.left)
  808. trail(water.right)
  809. for i=.5,1,.2 do
  810. wait()
  811. armWeld.left.C0=CFrame.Angles(math.rad(135)*i,0,-math.rad(5)*i)
  812. armWeld.right.C0=CFrame.Angles(math.rad(135)*i,0,math.rad(5)*i)
  813. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  814. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  815. end
  816. wait(.2)
  817. for i=9,0,-.2 do
  818. wait()
  819. armWeld.left.C0=CFrame.Angles(math.rad(135)*i,0,-math.rad(5)*i)
  820. armWeld.right.C0=CFrame.Angles(math.rad(135)*i,0,math.rad(5)*i)
  821. waterWeld.left.C1=CFrame.new(0,-2+(-math.random(10,12)*i),0)
  822. waterWeld.right.C1=CFrame.new(0,-2+(-math.random(10,12)*i),0)
  823. end
  824. trailDeb=false
  825. end,
  826. waterSpin=function()
  827. trail(water.left)
  828. trail(water.right)
  829. local bg=add.bg(torso,torso.CFrame)
  830. for i=.2,1,.2 do
  831. wait()
  832. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(90)*i)
  833. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(90)*i)
  834. waterWeld.left.C1=CFrame.new(0,-2+(-math.random(5,8)*i),0)
  835. waterWeld.right.C1=CFrame.new(0,-2+(-math.random(5,8)*i),0)
  836. end
  837. local bav=add.bav(torso,Vector3.new(0,75,0))
  838. wait(3)
  839. for i=1,0,-.2 do
  840. wait()
  841. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(90)*i)
  842. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(90)*i)
  843. waterWeld.left.C1=CFrame.new(0,-2+(-5*i),0)
  844. waterWeld.right.C1=CFrame.new(0,-2+(-5*i),0)
  845. end
  846. bg:remove()
  847. bav:remove()
  848. trailDeb=false
  849. end,
  850. bend=function(mouse)
  851. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  852. trail(water.left)
  853. trail(water.right)
  854. for i=.2,1,.2 do
  855. wait()
  856. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(90)*i)
  857. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(90)*i)
  858. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  859. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  860. end
  861. wait(.2)
  862. for i=4,0,-.2 do
  863. wait()
  864. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(45)*i)
  865. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(45)*i)
  866. waterWeld.left.C1=CFrame.new(0,-2+(-15*i),0)
  867. waterWeld.right.C1=CFrame.new(0,-2+(-15*i),0)
  868. end
  869. trailDeb=false
  870. end,
  871. watershoot2=function(mouse)
  872. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  873. trail(water.left)
  874. trail(water.right)
  875. for i=1,40 do
  876. 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))
  877. waterbull.Velocity=waterbull.CFrame.lookVector*100
  878. trail(waterbull)
  879. local bf=add.bf(waterbull,Vector3.new(0,waterbull:GetMass()*196.2,0))
  880. game.Debris:AddItem(waterbull,5)
  881. waterbull.Touched:connect(touch)
  882. end
  883. for i=.2,1,.2 do
  884. wait()
  885. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(90)*i)
  886. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(90)*i)
  887. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  888. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  889. end
  890. wait(.2)
  891. for i=1,0,-.2 do
  892. wait()
  893. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(90)*i)
  894. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(90)*i)
  895. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  896. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  897. end
  898. trailDeb=false
  899. end,
  900. AvatarSpecial=function(mouse)
  901. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  902. trail(water.left)
  903. trail(water.right)
  904. for i=1,40 do
  905. local waterbull=add.part(things,false,false,"Brown","Ball",0,Vector3.new(10,20,30),torso.CFrame*CFrame.Angles(0,math.rad(9)*i,0))
  906. waterbull.Velocity=waterbull.CFrame.lookVector*100
  907. trail(waterbull)
  908. local bf=add.bf(waterbull,Vector3.new(0,waterbull:GetMass()*196.2,0))
  909. game.Debris:AddItem(waterbull,5)
  910. waterbull.Touched:connect(touch)
  911. end
  912. for i=.2,1,.2 do
  913. wait()
  914. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(90)*i)
  915. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(90)*i)
  916. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  917. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  918. end
  919. wait(.2)
  920. for i=1,0,-.2 do
  921. wait()
  922. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(90)*i)
  923. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(90)*i)
  924. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  925. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  926. end
  927. trailDeb=false
  928. end,
  929. waterbending2=function(mouse)
  930. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  931. trail(water.left)
  932. trail(water.right)
  933. for i=1,40 do
  934. local waterbull=add.part(things,false,false,"Bright blue","Ball",0,Vector3.new(50,20,40),torso.CFrame*CFrame.Angles(0,math.rad(9)*i,0))
  935. waterbull.Velocity=waterbull.CFrame.lookVector*100
  936. trail(waterbull)
  937. local bf=add.bf(waterbull,Vector3.new(0,waterbull:GetMass()*196.2,0))
  938. game.Debris:AddItem(waterbull,5)
  939. waterbull.Touched:connect(touch)
  940. end
  941. for i=.6,1,.2 do
  942. wait()
  943. armWeld.left.C0=CFrame.Angles(math.rad(90)*i ,0,math.rad(90)*i)
  944. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(90)*i)
  945. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  946. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  947. end
  948. wait(.2)
  949. for i=1,0,-.2 do
  950. wait()
  951. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,math.rad(90)*i)
  952. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,-math.rad(90)*i)
  953. waterWeld.left.C1=CFrame.new(0,-2+(-10*i),0)
  954. waterWeld.right.C1=CFrame.new(0,-2+(-10*i),0)
  955. end
  956. trailDeb=false
  957. end,
  958. waterBack=function(mouse)
  959. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  960. trail(water.left)
  961. trail(water.right)
  962. for i=.2,1,.2 do
  963. wait()
  964. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,0)
  965. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,0)
  966. waterWeld.left.C1=CFrame.new(0,-2+(-20*i),0)
  967. waterWeld.right.C1=CFrame.new(0,-2+(-20*i),0)
  968. end
  969. wait(.2)
  970. for i=1,0,-.2 do
  971. wait()
  972. armWeld.left.C0=CFrame.Angles(math.rad(90)*i,0,0)
  973. armWeld.right.C0=CFrame.Angles(math.rad(90)*i,0,0)
  974. waterWeld.left.C1=CFrame.new(0,-2+(-20*i),0)
  975. waterWeld.right.C1=CFrame.new(0,-2+(-20*i),0)
  976. end
  977. trailDeb=false
  978. end,
  979. waterForward=function(mouse)
  980. torso.CFrame=computePos(torso.CFrame.p,mouse.Hit.p)
  981. torso.Anchored=true
  982. for i=.2,1,.2 do
  983. wait()
  984. armWeld.left.C0=CFrame.Angles(math.rad(135)*i,0,-math.rad(5)*i)
  985. armWeld.right.C0=CFrame.Angles(math.rad(135)*i,0,math.rad(5)*i)
  986. end
  987. for i=1,20 do
  988. wait()
  989. local waterblock=add.part(things,false,false,"Bright blue","Block",0,Vector3.new(9,7,9),torso.CFrame*CFrame.new(0,0,0)*CFrame.Angles(math.rad(45),0,0)+torso.CFrame.lookVector*2*i)
  990. trail(waterblock)
  991. game.Debris:AddItem(waterblock,1)
  992. waterblock.Touched:connect(touch)
  993. end
  994. wait(.2)
  995. torso.Anchored=false
  996. for i=1,0,-.2 do
  997. wait()
  998. armWeld.left.C0=CFrame.Angles(math.rad(135)*i,0,-math.rad(5)*i)
  999. armWeld.right.C0=CFrame.Angles(math.rad(135)*i,0,math.rad(5)*i)
  1000. end
  1001. trailDeb=false
  1002. end
  1003. }
  1004.  
  1005. function getTouched()
  1006. for i,v in pairs(things:GetChildren()) do
  1007. v.Touched:connect(touch)
  1008. end
  1009. end
  1010.  
  1011. local deb=false
  1012. local buttonDeb=false
  1013. local bin=Instance.new("HopperBin")
  1014. bin.Parent=player.Backpack
  1015. bin.Name="Avatar State"
  1016. bin.Selected:connect(function(mouse)
  1017. bin:remove()
  1018. anim.equip()
  1019. mouse.Button1Down:connect(function()
  1020. if deb==false then
  1021. deb=true
  1022. getTouched()
  1023. anim.watershoot(mouse)
  1024. anim.equip()
  1025. deb=false
  1026. end
  1027. end)
  1028. mouse.KeyDown:connect(function(key)
  1029. if key=="q" and deb==false then
  1030. deb=true
  1031. getTouched()
  1032. anim.waterRaise(mouse)
  1033. anim.equip()
  1034. deb=false
  1035. end
  1036. if key=="e" and deb==false then
  1037. deb=true
  1038. getTouched()
  1039. anim.waterSpin()
  1040. anim.equip()
  1041. deb=false
  1042. end
  1043. if key=="r" and deb==false then
  1044. deb=true
  1045. getTouched()
  1046. anim.bend(mouse)
  1047. anim.equip()
  1048. deb=false
  1049. end
  1050. if key=="f" and deb==false then
  1051. deb=true
  1052. getTouched()
  1053. anim.watershoot2(mouse)
  1054. anim.equip()
  1055. deb=false
  1056. end
  1057. if key=="c" and deb==false then
  1058. deb=true
  1059. getTouched()
  1060. anim.AvatarSpecial(mouse)
  1061. anim.equip()
  1062. deb=false
  1063. end
  1064. if key=="v" and deb==false then
  1065. deb=true
  1066. getTouched()
  1067. anim.waterbending2(mouse)
  1068. anim.equip()
  1069. deb=false
  1070. end
  1071. if key=="p" and deb==false then
  1072. deb=true
  1073. getTouched()
  1074. anim.watersh00t(mouse)
  1075. anim.equip()
  1076. deb=false
  1077. end
  1078. if key=="g" and deb==false then
  1079. deb=true
  1080. getTouched()
  1081. anim.waterBack(mouse)
  1082. anim.equip()
  1083. deb=false
  1084. end
  1085. if key=="h" and deb==false then
  1086. deb=true
  1087. getTouched()
  1088. anim.waterForward(mouse)
  1089. anim.equip()
  1090. deb=false
  1091. end
  1092. if key=="z" and buttonDeb==false then
  1093. buttonDeb=true
  1094. getTouched()
  1095. path()
  1096. end
  1097. if key=="z" and buttonDeb==true then
  1098. buttonDeb=false
  1099. pathPart:remove() torso["BodyPosition"]:remove()
  1100. end
  1101. end)
  1102. end)
  1103. --mediafire gtfo password
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement