Cakey3101

Fisch - 7 (RodScript)

Nov 9th, 2025 (edited)
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.58 KB | Source Code | 0 0
  1. local UserInputService = game:GetService("UserInputService")
  2. local Players = game:GetService("Players")
  3. local TweenService = game:GetService("TweenService")
  4. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  5.  
  6. local Tool: Tool = script.Parent
  7.  
  8. local Player = Players.LocalPlayer
  9. local PlayerGui = Player.PlayerGui
  10.  
  11. local ActiveTween: Tween = nil
  12. local ActiveBobber: BasePart = nil
  13.  
  14. local InWater = false
  15. local Clicked = true
  16. local IsShaking = false
  17. local Progress = 0
  18.  
  19. local ToolEquipped = false
  20.  
  21. local function CreateTween(Object: Instance, Info: TweenInfo, Properties)
  22.     if ActiveTween then
  23.         ActiveTween:Cancel()
  24.     end
  25.  
  26.     local Tween = TweenService:Create(Object, Info, Properties)
  27.     ActiveTween = Tween
  28.  
  29.     Tween:Play()
  30.  
  31.     return Tween
  32. end
  33.  
  34. local function ResetProgressAndUI()
  35.     Progress = 0
  36.     Clicked = true
  37.     InWater = false
  38.    
  39.     local Fishing = PlayerGui:WaitForChild("Fishing")
  40.    
  41.     if Fishing then
  42.         local MainFrame = Fishing.Main
  43.        
  44.         if MainFrame then
  45.             MainFrame.Casting.Visible = false
  46.            
  47.             local Bar = MainFrame.Casting.Bar
  48.             if Bar then
  49.                 Bar.Size = UDim2.new(Bar.Size.X.Scale, 0, 0, 0)
  50.                 Bar.Position = UDim2.new(Bar.Position.X.Scale, 0, 1, 0)
  51.             end
  52.         end
  53.        
  54.         local ShakeFrame = MainFrame.ShakeFrame
  55.         if ShakeFrame then
  56.             for _, Button: ImageButton in pairs(ShakeFrame:GetChildren()) do
  57.                 if Button:IsA("ImageButton") and Button.Name ~= "Template" then
  58.                     Button:Destroy()
  59.                 end
  60.             end
  61.         end
  62.        
  63.         if ActiveBobber then
  64.             ActiveBobber:Destroy()
  65.             ActiveBobber = nil
  66.         end
  67.        
  68.         if ActiveTween then
  69.             ActiveTween:Cancel()
  70.             ActiveTween = nil
  71.         end
  72.     end
  73. end
  74.  
  75. local function UpdateBarColour(Bar: Frame)
  76.     local Size = Bar.Size.Y.Scale
  77.     local Red = math.clamp(1 - Size, 0, 1)
  78.     local Green = math.clamp(Size, 0, 1)
  79.  
  80.     Bar.BackgroundColor3 = Color3.new(Red, Green, 0)
  81. end
  82.  
  83. local function AnimateBar(Bar: Frame)
  84.     Bar.Size = UDim2.new(Bar.Size.X.Scale, 0, 0, 0)
  85.     Bar.Position = UDim2.new(Bar.Position.X.Scale, 0, 1, 0)
  86.  
  87.     local BarInfo = TweenInfo.new(
  88.         1,
  89.         Enum.EasingStyle.Sine,
  90.         Enum.EasingDirection.InOut,
  91.         -1,
  92.         true
  93.     )
  94.  
  95.     local Tween = CreateTween(Bar, BarInfo, {
  96.         Size = UDim2.new(Bar.Size.X.Scale, 0, 1, 0),
  97.         Position = UDim2.new(Bar.Position.X.Scale, 0, 0, 0)
  98.     })
  99.  
  100.     return Tween
  101. end
  102.  
  103. local function Shake()
  104.     if InWater and ToolEquipped and not IsShaking then
  105.         IsShaking = true
  106.        
  107.         local ShakeFrame = PlayerGui:WaitForChild("Fishing").Main.ShakeFrame
  108.        
  109.         while Progress < 100 and IsShaking do
  110.             repeat task.wait() until Clicked
  111.            
  112.             Clicked = false
  113.  
  114.             local ShakeClone = ShakeFrame.Template:Clone()
  115.  
  116.             local RandomX = math.random() * 0.9
  117.             local RandomY = math.random() * 0.8
  118.  
  119.             ShakeClone.Position = UDim2.new(RandomX, 0, RandomY, 0)
  120.             ShakeClone.Name = Progress
  121.             ShakeClone.Visible = true
  122.            
  123.             ShakeClone.Parent = ShakeFrame
  124.  
  125.             local CanClick = true
  126.             ShakeClone.MouseButton1Click:Connect(function()
  127.                 if Clicked then
  128.                     return
  129.                 end
  130.                
  131.                 if CanClick and Progress < 100 then
  132.                     CanClick = false
  133.                     Clicked = true
  134.                    
  135.                     Progress += 5
  136.                    
  137.                     ShakeClone:Destroy()
  138.                 end
  139.             end)
  140.         end
  141.        
  142.         for _, Clone: ImageButton in pairs(ShakeFrame:GetChildren()) do
  143.             if Clone:IsA("ImageButton") and Clone.Name == "Template" then
  144.                 continue
  145.             end
  146.            
  147.             Clone:Destroy()
  148.         end
  149.        
  150.         IsShaking = false
  151.     end
  152. end
  153.  
  154. UserInputService.InputBegan:Connect(function(Input: InputObject, GameProcessedEvent: boolean)
  155.     if GameProcessedEvent then return end
  156.  
  157.     if ToolEquipped then
  158.         if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  159.             ResetProgressAndUI()
  160.            
  161.             if ActiveBobber then
  162.                 ActiveBobber:Destroy()
  163.             end
  164.  
  165.             local Fishing = PlayerGui:WaitForChild("Fishing")
  166.             local MainFrame = Fishing.Main
  167.             local Casting = MainFrame.Casting
  168.             local Bar = Casting.Bar
  169.  
  170.             Casting.Visible = true
  171.  
  172.             AnimateBar(Bar)
  173.  
  174.             task.spawn(function()
  175.                 while Casting do
  176.                     UpdateBarColour(Bar)
  177.                     task.wait(0.1)
  178.                 end
  179.             end)
  180.         end
  181.     end
  182. end)
  183.  
  184. UserInputService.InputEnded:Connect(function(Input: InputObject, GameProcessedEvent: boolean)
  185.     if GameProcessedEvent then return end
  186.  
  187.     if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  188.         local Fishing = PlayerGui:WaitForChild("Fishing")
  189.         local MainFrame = Fishing.Main
  190.         local Casting = MainFrame.Casting
  191.         local Bar = Casting.Bar
  192.  
  193.         Casting.Visible = false
  194.  
  195.         if ActiveTween then
  196.             ActiveTween:Cancel()
  197.         end
  198.  
  199.         local Power = Bar.Size.Y.Scale * 70
  200.  
  201.         local Bobber = ReplicatedStorage:WaitForChild("Bobber"):Clone()
  202.         local Rope = Bobber.Rope
  203.  
  204.         local Weld = Instance.new("Weld", Bobber)
  205.         Weld.Part0 = script.Parent.Handle
  206.         Weld.Part1 = Bobber
  207.  
  208.         Bobber.Position = script.Parent.Parent.PrimaryPart.Position + Vector3.new(-0.5, 8, -1)
  209.         Bobber.Parent = script.Parent
  210.  
  211.         Rope.Attachment0 = script.Parent.Handle.Rod
  212.         Rope.Attachment1 = Bobber.Bobber
  213.  
  214.         Bobber.Transparency = 0
  215.         Rope.Visible = true
  216.  
  217.         local Velocity = Instance.new("BodyVelocity", Bobber)
  218.         Velocity.MaxForce = Vector3.one * 100_000
  219.         Velocity.Velocity = script.Parent.Parent.Head.CFrame.LookVector * Power
  220.  
  221.         Weld:Destroy()
  222.  
  223.         Bobber.Anchored = false
  224.  
  225.         Bar.Size = UDim2.new(Bar.Size.X.Scale, 0, 0, 0)
  226.         Bar.Position = UDim2.new(Bar.Position.X.Scale, 0, 1, 0)
  227.  
  228.         ActiveBobber = Bobber
  229.  
  230.         task.delay(0.1, function()
  231.             Velocity:Destroy()
  232.         end)
  233.  
  234.         InWater = true
  235.         Shake()
  236.     end
  237. end)
  238.  
  239. Tool.Equipped:Connect(function()
  240.     ToolEquipped = true
  241.    
  242.     ResetProgressAndUI()
  243. end)
  244.  
  245. Tool.Unequipped:Connect(function()
  246.     ToolEquipped = false
  247.     IsShaking = false
  248.    
  249.     ResetProgressAndUI()
  250. end)
Advertisement
Add Comment
Please, Sign In to add comment