Upscalefanatic3

Water bending Script

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