mewishmeww

Water

Jul 24th, 2023 (edited)
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.49 KB | None | 0 0
  1. local plr = owner.Name
  2.  
  3. local tool = Instance.new("Tool")
  4. tool.Parent = game.Players:FindFirstChild(plr).Backpack
  5. tool.Name = "WaterTooler"
  6. tool.ToolTip = "Water Fighter!"
  7.  
  8. local mouse = Instance.new("RemoteEvent",tool)
  9. mouse.Name = "Mouse"
  10.  
  11. local deb1 = {}
  12. local deb2 = {}
  13.  
  14. function debris(instnace,time)
  15.     local num = 1
  16.     table.insert(deb1,instnace)
  17.     delay(time,function()
  18.           instnace:Destroy()
  19.     end)
  20. end
  21.  
  22. function biggify2(water,FT)
  23.     local waters = game.Workspace:FindFirstChild("WaterFolder123"):GetChildren()
  24.     local stop = false
  25.     for i=1, #waters do
  26.         if not stop then
  27.             local c = waters[i]
  28.             local dist = (waters[i].Position-water.Position).Magnitude
  29.             if dist*1.999<waters[i].Size.Z+water.Size.Z and waters[i] ~= water then
  30.                 stop = true
  31.             game:GetService("TweenService"):Create(waters[i],TweenInfo.new(0.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{Size = Vector3.new(0.1,waters[i].WaterSize.Value.Y+water.WaterSize.Value.Y,waters[i].WaterSize.Value.Y+water.WaterSize.Value.Y)}):Play()
  32.                 waters[i].WaterSize.Value = Vector3.new(0.1,waters[i].WaterSize.Value.Y+water.WaterSize.Value.Y,waters[i].WaterSize.Value.Y+water.WaterSize.Value.Y)
  33.                 debris(water,FT)
  34.                 waters[i]:Destroy()
  35.                 biggify2(water,FT)
  36.             end
  37.         end
  38.     end
  39. end
  40.  
  41. function biggify(water,FADETIM)
  42.     local waters = game.Workspace:FindFirstChild("WaterFolder123"):GetChildren()
  43.     local stop = false
  44.     for i=1, #waters do
  45.         if not stop then
  46.             local c = waters[i]
  47.             local dist = (waters[i].Position-water.Position).Magnitude
  48.             if dist*1.999<waters[i].Size.Z+water.Size.Z and waters[i] ~= water then
  49.                 stop = true
  50.             game:GetService("TweenService"):Create(waters[i],TweenInfo.new(0.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{Size = Vector3.new(0.1,waters[i].WaterSize.Value.Y+water.WaterSize.Value.Y,waters[i].WaterSize.Value.Y+water.WaterSize.Value.Y)}):Play()
  51.                 waters[i].WaterSize.Value = Vector3.new(0.1,waters[i].WaterSize.Value.Y+water.WaterSize.Value.Y,waters[i].WaterSize.Value.Y+water.WaterSize.Value.Y)
  52.                 debris(waters[i],FADETIM)
  53.                 water:Destroy()
  54.                 biggify2(waters[i],FADETIM)
  55.             end
  56.         end
  57.     end
  58. end
  59.  
  60. NLS('local tool = game.Players.LocalPlayer.Backpack:WaitForChild("WaterTooler") local mouse = game.Players.LocalPlayer:GetMouse() mouse.Button1Down:Connect(function() print("clicked") tool:FindFirstChild("Mouse"):FireServer(mouse.Hit) end)',game.Players:FindFirstChild(owner.Name).Character)
  61. function realWater(Position,VelPos,Size,PuddleSize,GravityStart,GravityIncrease,Color,Material,Parent,FadeTime,Transparency,disapearOnPlayer,ignore)
  62.     if not game.Workspace:FindFirstChild("WaterFolder123") then
  63.         local wtrFold = Instance.new("Folder",workspace)
  64.         wtrFold.Name = "WaterFolder123"
  65.     end
  66.     local waterDrop = Instance.new("Part",game.Workspace:FindFirstChild("WaterFolder123"))
  67.     waterDrop.Shape = "Ball"
  68.     waterDrop.Name = "DROPOFTHEWATETER"
  69.     waterDrop.Size = Vector3.new(Size,Size,Size)
  70.     waterDrop.Anchored = true
  71.     waterDrop.CanCollide = false
  72.     waterDrop.Position = Position
  73.     waterDrop.Material = Material
  74.     waterDrop.Color = Color
  75.     waterDrop.Transparency = Transparency
  76.     debris(waterDrop,FadeTime)
  77.    
  78.     local gravity = GravityStart
  79.     local stop = false
  80.     local rsr
  81.     rsr = game:GetService("RunService").Heartbeat:Connect(function()
  82.         if not stop then
  83.             local raycastParams = RaycastParams.new()
  84.             table.insert(ignore,game.Workspace:FindFirstChild("WaterFolder123"))
  85.             raycastParams.FilterDescendantsInstances = ignore
  86.             raycastParams.FilterType = Enum.RaycastFilterType.Exclude
  87.             raycastParams.IgnoreWater = true
  88.  
  89.             local ray = workspace:Raycast(waterDrop.Position,(VelPos+Vector3.new(0,gravity,0)),raycastParams)
  90.             if ray then
  91.                 if disapearOnPlayer then
  92.                     if not ray.Instance.Parent:FindFirstChildWhichIsA("Humanoid") then
  93.                         if not ray.Instance.Parent.Parent:FindFirstChildWhichIsA("Humanoid") then
  94.                             stop = true
  95.                             waterDrop.Shape = "Cylinder"
  96.                             waterDrop.Anchored = true
  97.                             waterDrop.Size = Vector3.new(0.1,Size,Size)
  98.                             waterDrop.CanCollide = false
  99.                             waterDrop.Material = Material
  100.                             waterDrop.Color = Color
  101.                             waterDrop.Position = ray.Position
  102.                             waterDrop.Transparency = Transparency
  103.                             waterDrop.CFrame = CFrame.new(ray.Position,ray.Position+ray.Normal) * CFrame.Angles(0, math.pi / 2, 0)
  104.                 game:GetService("TweenService"):Create(waterDrop,TweenInfo.new(0.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{Size = Vector3.new(0.1,PuddleSize,PuddleSize)}):Play()
  105.                             local waterSize = Instance.new("Vector3Value",waterDrop)
  106.                             waterSize.Name = "WaterSize"
  107.                             waterSize.Value = waterDrop.Size
  108.                             delay(1, function()
  109.                                 local waterSize = Instance.new("Vector3Value",waterDrop)
  110.                                 waterSize.Name = "WaterSize"
  111.                                 waterSize.Value = waterDrop.Size
  112.                                 biggify(waterDrop,FadeTime)
  113.                             end)
  114.  
  115.                             return waterDrop, ray.Instance
  116.                         else
  117.                             stop = true
  118.                             waterDrop:Destroy()
  119.                             if not ray.Instance:FindFirstChild("WATERCOVER") and ray.Instance.Name ~= "WATERCOVER" then
  120.                                 local cover
  121.                                 if ray.Instance.Name == "HumanoidRootPart" then
  122.                                     if ray.Instance.Parent.Parent:FindFirstChild("LowerTorso") then
  123.                                         cover = ray.Instance.Parent.Parent.UpperTorso:Clone()
  124.                                     else
  125.                                         cover = ray.Instance.Parent.Parent.Torso:Clone()
  126.                                     end
  127.                                 else
  128.                                     cover = ray.Instance:Clone()
  129.                                 end
  130.                                 for i=1, #cover:GetDescendants() do
  131.                                     cover:GetDescendants()[i]:Destroy()
  132.                                 end
  133.                                 local CoverSize = cover.Size*1.1
  134.                                 cover.Size = Vector3.new(0.001,0.001,0.001)
  135.                                 cover.Parent = ray.Instance
  136.                                 cover.CanCollide = false
  137.                                 cover.Position = Position
  138.                                 cover.Material = Material
  139.                                 cover.Color = Color
  140.                                 cover.Name = "WATERCOVER"
  141.                                 cover.Transparency = Transparency
  142.                                 local weld = Instance.new("Weld")
  143.                                 weld.Parent = cover
  144.                                 weld.Part0 = cover
  145.                                 weld.Part1 = ray.Instance
  146.                                 game.Debris:AddItem(cover,FadeTime)
  147.                             game:GetService("TweenService"):Create(cover,TweenInfo.new(0.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{Size = CoverSize}):Play()
  148.                             end
  149.                             return ray.Instance.Parent.Parent, "Parent2"
  150.                         end
  151.                     else
  152.                         stop = true
  153.                         waterDrop:Destroy()
  154.                         if not ray.Instance:FindFirstChild("WATERCOVER") and ray.Instance.Name ~= "WATERCOVER" then
  155.                             local cover
  156.                             if ray.Instance.Name == "HumanoidRootPart" then
  157.                                 if ray.Instance.Parent:FindFirstChild("LowerTorso") then
  158.                                     cover = ray.Instance.Parent.UpperTorso:Clone()
  159.                                 else
  160.                                     cover = ray.Instance.Parent.Torso:Clone()
  161.                                 end
  162.                             else
  163.                                 cover = ray.Instance:Clone()
  164.                             end
  165.                             for i=1, #cover:GetDescendants() do
  166.                                 local c = cover:GetDescendants()[i]
  167.                                 if c ~= nil then
  168.                                     c:Destroy()
  169.                                 end
  170.                             end
  171.                             local CoverSize = cover.Size*1.1
  172.                             cover.Size = Vector3.new(0.001,0.001,0.001)
  173.                             cover.Parent = ray.Instance
  174.                             cover.CanCollide = false
  175.                             cover.Position = Position
  176.                             cover.Material = Material
  177.                             cover.Color = Color
  178.                             cover.Name = "WATERCOVER"
  179.                             cover.Transparency = Transparency
  180.                             local weld = Instance.new("Weld")
  181.                             weld.Parent = cover
  182.                             weld.Part0 = cover
  183.                             weld.Part1 = ray.Instance
  184.                             game.Debris:AddItem(cover,FadeTime)
  185.                             game:GetService("TweenService"):Create(cover,TweenInfo.new(0.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{Size = CoverSize}):Play()
  186.                         end
  187.                         return ray.Instance.Parent, "Parent1"
  188.                     end
  189.                 else
  190.                     stop = true
  191.                     waterDrop.Shape = "Cylinder"
  192.                     waterDrop.Anchored = true
  193.                     waterDrop.Size = Vector3.new(0.1,Size,Size)
  194.                     waterDrop.CanCollide = false
  195.                     waterDrop.Material = Material
  196.                     waterDrop.Color = Color
  197.                     waterDrop.Position = ray.Position
  198.                     waterDrop.Transparency = Transparency
  199.                     waterDrop.CFrame = CFrame.new(ray.Position,ray.Position+ray.Normal) * CFrame.Angles(0, math.pi / 2, 0)
  200.                 game:GetService("TweenService"):Create(waterDrop,TweenInfo.new(0.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{Size = Vector3.new(0.1,PuddleSize,PuddleSize)}):Play()
  201.                                 delay(1, function()
  202.                                     local waterSize = Instance.new("Vector3Value",waterDrop)
  203.                                     waterSize.Name = "WaterSize"
  204.                                     waterSize.Value = waterDrop.Size
  205.                                     biggify(waterDrop,FadeTime)
  206.                                 end)
  207.  
  208.                     return waterDrop, ray.Instance
  209.                 end
  210.             end
  211.             if not stop then
  212.                 waterDrop.CFrame += (VelPos+Vector3.new(0,gravity,0))
  213.                 gravity -= GravityIncrease
  214.             else
  215.                 rsr:Disconnect()
  216.             end
  217.         end
  218.     end)
  219. end
  220.  
  221. function DripWater(water,instance,Speed,ignore,array)
  222.     local e = game:GetService("RunService").Heartbeat:Connect(function()
  223.         if water ~= nil then
  224.             if not water:FindFirstChild("Wait") then
  225.                 local waitbool = Instance.new("BoolValue",water)
  226.                 waitbool.Name = "Wait"
  227.                 game.Debris:AddItem(waitbool,1)
  228.                 local drip = realWater(Vector3.new(water.Position.X+math.random(-water.Size.X,water.Size.X),water.Position.Y-(water.Size.Z/3)/2,water.Position.Z+math.random(-water.Size.Z,water.Size.Z)),Vector3.new(0,0,0),water.Size.Z/3,water.Size.Z/2,0,0.005,water.Color,water.Material,water,30,water.Transparency,true,{})
  229.                 table.insert(array,drip)
  230.             end
  231.         end
  232.     end)
  233.     local dis
  234.     dis = game.Workspace.DescendantRemoving:Connect(function(objectWhichWasRemoved)
  235.         if objectWhichWasRemoved == water then
  236.             e:Disconnect()
  237.             dis:Disconnect()
  238.         end
  239.     end)
  240. end
  241.  
  242. mouse.OnServerEvent:Connect(function(p,mouseHit)
  243.     local pos = tool.Parent:WaitForChild("HumanoidRootPart").Position
  244.     local velocity = (mouseHit.p-tool.Parent:WaitForChild("HumanoidRootPart").Position).Unit
  245.     local size = 1
  246.     local puddleSize = 3
  247.     local gravityStart = 0.1
  248.     local gravityIncrease = 0.01
  249.     local WaterColor = Color3.new(0.0784314, 0.603922, 0.603922)
  250.     local Material = Enum.Material.Glass
  251.     local parent = workspace
  252.     local Fadetime = 15
  253.     local transparency = 0.5
  254.     local disapearOnPlayer = true
  255.     local ignore = {tool.Parent}
  256.     local water, other = realWater(pos,velocity,size,puddleSize,gravityStart,gravityIncrease,WaterColor,Material,parent,Fadetime,transparency,disapearOnPlayer,ignore)
  257.     if other ~= "Parent1" and other ~= "Parent2" then
  258.         local drippedWaters = {}
  259.         DripWater(water,other,1,ignore,drippedWaters)
  260.     end
  261.     if other == "Parent1" then
  262.         local char = water.Parent
  263.     end
  264.     if other == "Parent2" then
  265.         local char = water.Parent.Parent
  266.     end
  267. end)
Advertisement
Add Comment
Please, Sign In to add comment