Advertisement
geedcat

FishScripts

Sep 25th, 2022 (edited)
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.59 KB | Gaming | 0 0
  1. -- LocalScript for Fish
  2. local rp = game:GetService("ReplicatedStorage")
  3.  
  4. local FishRemote = rp:WaitForChild("FishRemote")
  5.  
  6. local UIS = game:GetService("UserInputService")
  7.  
  8. local Debounce = false
  9.  
  10. local cooldown = 2
  11.  
  12. UIS.InputBegan:Connect(function(input, isTyping)
  13.     if not isTyping then
  14.         if input.KeyCode == Enum.KeyCode.X then --checks to see if player is pressing key x
  15.             if Debounce == false then --sets denounce
  16.                 Debounce = true
  17.                
  18.                 FishRemote:FireServer() --fires a remote to the server to continue
  19.             end
  20.            
  21.            
  22.         end
  23.        
  24.        
  25.     end
  26.    
  27. end)
  28.  
  29. FishRemote.OnClientEvent:Connect(function() --uses server debouncing
  30.     wait(cooldown)
  31.     Debounce = false
  32. end)
  33.  
  34. -- Fish Servescript
  35. local rp = game:GetService("ReplicatedStorage")
  36. local FishRemote = rp:WaitForChild("FishRemote")
  37. local CamRemote = rp:WaitForChild("CamShake")
  38. local FishModule = require(script.FishModule)
  39.  
  40.  
  41. FishRemote.OnServerEvent:Connect(function(Player)
  42.     local character = Player.Character
  43.     local humanoid = character.Humanoid
  44.     local Root = character.HumanoidRootPart
  45.  
  46.     local Folder = Instance.new("Folder") --Creates a folder to store fish moves in
  47.     local tickdamage = rp.Effects.Chrollo.TickDamage.Value
  48.     Folder.Name = Player.Name.." Fish Move"
  49.     Folder.Parent = workspace
  50.  
  51.     local OldSpeed = humanoid.WalkSpeed --sets character stats like walkspeed and jump
  52.     local OldJumpPower = humanoid.JumpPower
  53.     local bookAnim = rp.Effects.Chrollo.Animations.BookAnimation --sets an placeholder book holding animation and plays
  54.     local BookPoseTrack = humanoid:LoadAnimation(bookAnim)
  55.     BookPoseTrack:Play()
  56.     humanoid.WalkSpeed = OldSpeed - OldSpeed --Makes sure the walkspeed is always 0
  57.     humanoid.JumpPower = OldJumpPower - OldJumpPower
  58.     task.wait(1)
  59.     CamRemote:FireClient(Player) --fires a remote to start screen effects
  60.    
  61.    
  62.     game.Debris:AddItem(Folder,8) --Destroys fish assets after time which are stored in a folder
  63.    
  64.     spawn(function()-settings parts for the module script
  65.         FishModule.rotation(Folder,Root,character)
  66.     end)
  67.    
  68.     spawn(function()
  69.         FishModule.damage(character,Root, tickdamage)
  70.     end)
  71.     task.delay(4,function() --returning character to old state
  72.         humanoid.WalkSpeed = OldSpeed
  73.         humanoid.JumpPower = OldJumpPower
  74.         BookPoseTrack:Stop()
  75.         game.Debris:AddItem(BookPoseTrack,1)
  76.     end)
  77.    
  78.     task.delay(8, function()
  79.         FishRemote:FireClient(Player)
  80.     end)
  81. end)
  82.  
  83. --Fish Module script
  84. local meshes = game.ReplicatedStorage.Effects.Chrollo
  85.  
  86. local RS = game:GetService("RunService")
  87. local TS = game:GetService("TweenService")
  88. local Debris = game:GetService("Debris")
  89.  
  90. local colorchangeremote = game.ReplicatedStorage.ColorChangeRemote
  91.  
  92. local FishModule = {}
  93.  
  94.  
  95. function FishModule.rotation(Folder, Root, character)
  96.     local hitbox = meshes.HitBox:Clone() --Setting up a hit box
  97.     hitbox.CFrame = Root.CFrame *CFrame.new(0,-1,0)
  98.     hitbox.Parent = Folder
  99.     hitbox.Attachment.Poof:Emit(20)
  100.     hitbox.Attachment.Wind.Enabled = true
  101.     hitbox.Attachment.Slash.Enabled = true
  102.     hitbox.Fog.Enabled = true
  103.     hitbox.Attachment.Wind2.Enabled = true
  104.     hitbox.Attachment2.Dirt.Enabled = true
  105.     hitbox.Attachment2.Ticks.Enabled = true
  106.     local book = meshes.Book
  107.  
  108.    
  109.     local fish = meshes.IndoorFishModel:Clone() --setting up the fish and it’s animations
  110.     local fish2 = meshes.IndoorFishModel:Clone()
  111.     fish.Parent = Folder
  112.     fish2.Parent = Folder
  113.     local animcontroller = fish.AnimationController
  114.     local animcontroller2 = fish2.AnimationController
  115.     local anim = meshes.Animations.FishAnimation
  116.     local fishtrack = animcontroller:LoadAnimation(anim)
  117.     local fishtrack2 = animcontroller2:LoadAnimation(anim)
  118.    
  119.     fish:SetPrimaryPartCFrame(hitbox.CFrame * CFrame.new(0,7,0))
  120.     fish2:SetPrimaryPartCFrame(hitbox.CFrame * CFrame.new(0,7,0))
  121.     fishtrack:Play()
  122.     fishtrack2:Play()
  123.      TS:Create(fish.PrimaryPart,TweenInfo.new(2),{Transparency = 0, }):Play()
  124.      TS:Create(fish2.PrimaryPart,TweenInfo.new(2),{Transparency = 0, }):Play()
  125.    
  126.     fish.SurfaceAppearance.Parent = fish.PrimaryPart --Starting vfx particles
  127.     fish.PrimaryPart.Dots.Enabled = true
  128.     fish.PrimaryPart.Drops.Enabled = true
  129.     fish.PrimaryPart.Smoke.Enabled = true
  130.     fish.PrimaryPart.Smoke2.Enabled = true
  131.    
  132.     fish2.SurfaceAppearance.Parent = fish2.PrimaryPart
  133.     fish2.PrimaryPart.Dots.Enabled = true
  134.     fish2.PrimaryPart.Drops.Enabled = true
  135.     fish2.PrimaryPart.Smoke.Enabled = true
  136.     fish2.PrimaryPart.Smoke2.Enabled = true
  137.    
  138.    
  139.     --[[
  140.     local degree = 0 —- Rotating the fish in a circular motion
  141.     local degree2 = 0
  142.     --]]
  143.    
  144.     local rotateAboutOrigin = hitbox
  145.  
  146.     local radius = 10
  147.     local originCFrame = hitbox.CFrame
  148.     local alignFish1 = CFrame.new(-radius,10,0)
  149.     local alignFish2 = CFrame.new(radius,12,0)
  150.  
  151.     local elapsed = 0
  152.     local offset1 = fish.PrimaryPart.CFrame:Inverse() * rotateAboutOrigin.CFrame
  153.     local offset2 = fish2.PrimaryPart.CFrame:Inverse() * rotateAboutOrigin.CFrame
  154.    
  155.     local connection
  156.    
  157.    
  158.      connection = RS.Heartbeat:Connect(function(dt)
  159.  
  160.         elapsed+=dt
  161.         fish:SetPrimaryPartCFrame( originCFrame * CFrame.Angles(0, math.rad(1)*elapsed*80, 0) * offset1 * alignFish1)
  162.         fish2:SetPrimaryPartCFrame( originCFrame * CFrame.Angles(0, math.rad(-1)*elapsed*-80, 0) * offset2 * alignFish2)
  163.        
  164.         fish:SetPrimaryPartCFrame(CFrame.new(fish.PrimaryPart.Position,  hitbox.Position))
  165.         fish2:SetPrimaryPartCFrame(CFrame.new(fish2.PrimaryPart.Position,  hitbox.Position))
  166.     end)
  167.    
  168.     delay(4, function() --Stopping fish VFX
  169.         fish.PrimaryPart.Smoke.LockedToPart = false
  170.         fish.PrimaryPart.Smoke2.LockedToPart = false
  171.         fish2.PrimaryPart.Smoke.LockedToPart = false
  172.         fish2.PrimaryPart.Smoke2.LockedToPart = false
  173.     end)
  174.     delay(5, function()
  175.         fish.PrimaryPart.SurfaceAppearance:Destroy()
  176.         fish.PrimaryPart.Material = Enum.Material.Neon
  177.         fish.PrimaryPart.Color = Color3.new(0.666667, 0.894118, 1)
  178.        
  179.         fish2.PrimaryPart.SurfaceAppearance:Destroy()
  180.         fish2.PrimaryPart.Material = Enum.Material.Neon
  181.         fish2.PrimaryPart.Color = Color3.new(0.666667, 0.894118, 1)
  182.        
  183.         TS:Create(fish.PrimaryPart,TweenInfo.new(1.5,Enum.EasingStyle.Quad), {Transparency = 1, Size = Vector3.new(0,0,0)}):Play()
  184.         TS:Create(fish2.PrimaryPart,TweenInfo.new(1.5,Enum.EasingStyle.Quad), {Transparency = 1, Size = Vector3.new(0,0,0)}):Play()
  185.        
  186.         fish.PrimaryPart.FadeParticles:Emit(80)
  187.    
  188.        
  189.         fish2.PrimaryPart.FadeParticles:Emit(80)
  190.    
  191.     end)
  192.    
  193.     delay(7, function()
  194.         if connection then
  195.             connection:Disconnect()--stopping data leak
  196.         end
  197.        
  198.     end)
  199.     function FishModule.damage(char,Root, tickdamage) --Setting up the damage
  200.         local people = workspace.People
  201.  
  202.         local bool = true
  203.         delay(5, function()
  204.             bool = false
  205.         end)
  206.  
  207.         while true do
  208.             if bool == false then
  209.                 break
  210.             end
  211.  
  212.             for _, plr in pairs(people:GetChildren()) do --checking if it’s an object in the people folder to actually work
  213.                     if plr ~= char then
  214.  
  215.                         local distance = 9
  216.                         local enemyhum = plr:FindFirstChild("Humanoid")
  217.                         local enemyroot = plr:FindFirstChild("HumanoidRootPart")
  218.                         local currentDist = (hitbox.CFrame.Position - enemyroot.CFrame.Position).Magnitude
  219.                         local ParticleAttachment = game.ReplicatedStorage.Effects.Chrollo.ImpactEffect.ImpactEffect:Clone()
  220.                         local OldSpeed = enemyhum.WalkSpeed
  221.                         local OldJumpPower = enemyhum.JumpPower
  222.                         local bp = Instance.new("BodyPosition"):Clone()
  223.                         bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  224.  
  225.                         if currentDist <= distance then --checking if their near the player
  226.                             if enemyhum and enemyhum.Health > 0 then
  227.                                 local char = enemyhum.Parent
  228.                                 local player = game.Players:GetPlayerFromCharacter(char)
  229.                                 local floatAnim = game.ReplicatedStorage.Effects.Chrollo.Animations.FloatingAnimation
  230.                                 local floatTrack = enemyhum:LoadAnimation(floatAnim)
  231.  
  232.                                 floatTrack:Play()
  233.  
  234.                                 ParticleAttachment.Parent = enemyroot --playing hit VFX
  235.                                 ParticleAttachment.ImpactEffect3:Emit(5)
  236.                                 ParticleAttachment.ImpactEffect4:Emit(15)
  237.                                 enemyhum.WalkSpeed = OldSpeed - OldSpeed
  238.                                 enemyhum.JumpPower = OldJumpPower - OldJumpPower
  239.                                 bp.Parent = enemyroot
  240.                                 bp.Position =  enemyroot.Position
  241.  
  242.                                 enemyhum:TakeDamage(tickdamage)
  243.  
  244.                                 delay(6,function() --Putting affected enemy back to old state
  245.                                     enemyhum.WalkSpeed = OldSpeed
  246.                                     enemyhum.JumpPower = OldJumpPower
  247.                                     floatTrack:Stop()
  248.                                     Debris:AddItem(bp,0.1)
  249.                                     Debris:AddItem(floatTrack,0.1)
  250.                                 end)
  251.                                 if player then
  252.                                     colorchangeremote:FireClient(player) --Adding a screen effect if it’s a player that’s hit
  253.                                 end
  254.                             end
  255.                         end
  256.  
  257.  
  258.                     end
  259.                
  260.            
  261.             end
  262.             wait(1)
  263.         end
  264.  
  265.  
  266.     end
  267.  
  268. end
  269.  
  270.  
  271.  
  272.  
  273.  
  274. return FishModule
  275.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement