RazBerry916

Sword VFX system

Jun 3rd, 2023
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.35 KB | Source Code | 0 0
  1. wait()
  2. local mode = "Sword"
  3. local modes = {"Sword", "Ranged"}
  4. debounce = false
  5. blocking=false
  6. heavyReady=true
  7. heavyReady2=true
  8. local Light=1
  9. local lastClick=tick()
  10. local ChangeModeWait=0.6
  11. local combotime = tick()
  12. local attackWait=0.25
  13. local SwordWalkSpeed=25
  14. local RangedWalkSpeed=16
  15. local hitstun=0
  16. local BlockingAnim =game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.BlockingAnim)
  17. game.ReplicatedStorage.Remotes.WeaponChange:InvokeServer(mode, SwordWalkSpeed, RangedWalkSpeed)
  18. function SlashVFXClient(enemy)
  19.     spawn(function()
  20.         local slashVFX = game.ReplicatedStorage.InsertParts.SlashEffect:Clone()
  21.         slashVFX.Parent=enemy
  22.         slashVFX.CFrame=enemy.HumanoidRootPart.CFrame*CFrame.Angles(0,0,0)*CFrame.new(0,0,-4)
  23.  
  24.         game:GetService("Debris"):AddItem(slashVFX,0.45)
  25.         local goal = {Size=Vector3.new(19.2, 0.473, 6.62)}
  26.         goal =  {Size=Vector3.new(21, 0.873, 9.42)}
  27.  
  28.         local goal2 = {Transparency=1}
  29.  
  30.         game:GetService("TweenService"):Create(slashVFX,TweenInfo.new(0.45),goal2):Play()
  31.         game:GetService("TweenService"):Create(slashVFX,TweenInfo.new(0.45),goal):Play()
  32.  
  33.         local slashVFX2 = game.ReplicatedStorage.InsertParts.SlashEffect2:Clone()
  34.         slashVFX2.Parent=enemy
  35.         slashVFX2.CFrame=enemy.HumanoidRootPart.CFrame*CFrame.Angles(0,0,0)*CFrame.new(0,0.35,-4)
  36.  
  37.         game:GetService("Debris"):AddItem(slashVFX2,0.45)
  38.         local goal3 = {Size=Vector3.new(19.2, 0.473, 6.62)}
  39.  
  40.         local goal4 = {Transparency=1}
  41.         game:GetService("TweenService"):Create(slashVFX2,TweenInfo.new(0.45),goal3):Play()
  42.         game:GetService("TweenService"):Create(slashVFX2,TweenInfo.new(0.45),goal4):Play()
  43.  
  44.     end)
  45. end
  46. function Beam(enemy)
  47.     spawn(function()
  48.         local sound = Instance.new("Sound",enemy.HumanoidRootPart)
  49.         sound.SoundId="rbxassetid://1146691360"
  50.         sound:Play()
  51.         game:GetService("Debris"):AddItem(sound,3)
  52.         local cylinder = game.ReplicatedStorage.InsertParts.WeirdCylinder:Clone()
  53.         local bv1 = Instance.new("BodyVelocity")
  54.         bv1.MaxForce=Vector3.new(math.huge,math.huge,math.huge)
  55.         bv1.Velocity = enemy.HumanoidRootPart.CFrame.lookVector*0
  56.         bv1.Parent=cylinder
  57.         cylinder.CFrame=enemy.HumanoidRootPart.CFrame*CFrame.Angles(0,-55,0) * CFrame.new(0,0,0)
  58.         cylinder.Parent=workspace
  59.         local properties = {Size = Vector3.new(80,10,10),CFrame = cylinder.CFrame + cylinder.CFrame.rightVector*40, }
  60.         local T1 = TweenInfo.new(0.75,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
  61.         local Tween = game:GetService("TweenService"):Create(cylinder,T1,properties):Play()
  62.         local cylinder2 = game.ReplicatedStorage.InsertParts.WeirdCylinder:Clone()
  63.         local bv2 = Instance.new("BodyVelocity")
  64.         bv2.MaxForce=Vector3.new(math.huge,math.huge,math.huge)
  65.         bv2.Velocity = enemy.HumanoidRootPart.CFrame.lookVector*0
  66.         bv2.Parent=cylinder2
  67.         cylinder2.Color=Color3.new(0, 0, 0)
  68.         cylinder2.CFrame=enemy.HumanoidRootPart.CFrame*CFrame.Angles(0,-55,0) * CFrame.new(0,0,0)
  69.         cylinder2.Parent=workspace
  70.         local properties2 = {Size = Vector3.new(85,12,12),CFrame = cylinder2.CFrame + cylinder2.CFrame.rightVector*40, Transparency=0.5}
  71.         local T2 = TweenInfo.new(0.75,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
  72.         local Tween2 = game:GetService("TweenService"):Create(cylinder2,T2,properties2):Play()
  73.         game:GetService("Debris"):AddItem(cylinder2,0.75)
  74.         game:GetService("Debris"):AddItem(cylinder,0.75)
  75.         local ring = game.ReplicatedStorage.InsertParts.Ring:Clone()
  76.         ring.Parent=enemy
  77.         ring.CFrame=enemy.HumanoidRootPart.CFrame*CFrame.Angles(0,0,0) * CFrame.new(0,0,-1)
  78.         local goal3 = {Size=Vector3.new(13.464, 12.021, 0.164)}
  79.         local goal4 = {Transparency=1}
  80.         game:GetService("Debris"):AddItem(ring,0.75)
  81.         game:GetService("TweenService"):Create(ring,TweenInfo.new(0.75),goal3):Play()
  82.         game:GetService("TweenService"):Create(ring,TweenInfo.new(0.75),goal4):Play()
  83.         local ball = game.ReplicatedStorage.InsertParts.Ball:Clone()
  84.         ball.Parent=workspace
  85.         ball.CFrame=enemy.HumanoidRootPart.CFrame*CFrame.new(0,0,-1)
  86.         game:GetService("Debris"):AddItem(ball,0.75)
  87.  
  88.         cylinder.Touched:Connect(function(hit)
  89.             if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name~=enemy.Name then
  90.                 cylinder2:Destroy()
  91.                 cylinder:Destroy()
  92.                 ball:Destroy()
  93.                     local wind = game.ReplicatedStorage.InsertParts.DarkRedWind:Clone()
  94.                     wind.Parent=hit.Parent
  95.                     wind.CFrame=hit.Parent.HumanoidRootPart.CFrame*CFrame.Angles(0,0,0) * CFrame.new(0,0,0)
  96.                     local goal3 = {Size=Vector3.new(9.563, 10.572, 9.18), Transparency=1}
  97.                 local sound = Instance.new("Sound",hit.Parent.HumanoidRootPart)
  98.                 sound.SoundId="rbxassetid://2885026620"
  99.                 sound:Play()
  100.                 game:GetService("Debris"):AddItem(sound,1)
  101.                
  102.                     game:GetService("Debris"):AddItem(wind,0.75)
  103.                     game:GetService("TweenService"):Create(wind,TweenInfo.new(0.75),goal3):Play()
  104.                 local ball2 = game.ReplicatedStorage.InsertParts.Ball:Clone()
  105.                 ball2.Size=Vector3.new(1,1,1)
  106.                 ball2.Parent=workspace
  107.                 ball2.CFrame=hit.Parent.HumanoidRootPart.CFrame*CFrame.new(0,0,-1)
  108.                 local goal3 = {Size=Vector3.new(16.789, 16.789, 16.789), Transparency=1}
  109.                 game:GetService("TweenService"):Create(ball2,TweenInfo.new(0.75),goal3):Play()
  110.                 game:GetService("Debris"):AddItem(ball2,0.75)
  111.                     spawn(function()
  112.                         while true do
  113.                             wind.Orientation=wind.Orientation+Vector3.new(0,-25,0)
  114.                             wait()
  115.                         end
  116.                     end)
  117.                
  118.             end
  119.         end)
  120.     end)
  121. end
  122. function absorbCircle(enemy)
  123.     spawn(function()
  124.         local sound = Instance.new("Sound",enemy.HumanoidRootPart)
  125.         sound.SoundId="rbxassetid://5822757538"
  126.         sound:Play()
  127.         game:GetService("Debris"):AddItem(sound,0.5)
  128.         local spinningCircleVFX2 = game.ReplicatedStorage.InsertParts.BigSpinningCircles:Clone()
  129.         spinningCircleVFX2.Parent=enemy
  130.         game:GetService("Debris"):AddItem(spinningCircleVFX2,0.35)
  131.         spinningCircleVFX2.CFrame=enemy.HumanoidRootPart.CFrame*CFrame.Angles(0,0,0)*CFrame.new(0,-2,0)
  132.         local goal3 = {Size=Vector3.new(0.5,0.5,0.5)}
  133.         local goal4 = {Transparency=1}
  134.  
  135.         game:GetService("TweenService"):Create(spinningCircleVFX2,TweenInfo.new(0.1),goal3):Play()
  136.         game:GetService("TweenService"):Create(spinningCircleVFX2,TweenInfo.new(0.35),goal4):Play()
  137.         game:GetService("Debris"):AddItem(spinningCircleVFX2,0.45)
  138.         spawn(function()
  139.             while true do
  140.                 spinningCircleVFX2.Orientation=spinningCircleVFX2.Orientation+Vector3.new(0,-25,0)
  141.                 wait()
  142.             end
  143.         end)
  144.     end)
  145. end
  146. function LetOutCircle(enemy)
  147.     spawn(function()
  148.         local spinningCircleVFX2 = game.ReplicatedStorage.InsertParts.SmallSpinningCircles:Clone()
  149.         spinningCircleVFX2.Parent=enemy
  150.         game:GetService("Debris"):AddItem(spinningCircleVFX2,0.45)
  151.         spinningCircleVFX2.CFrame=enemy.HumanoidRootPart.CFrame*CFrame.Angles(0,0,0)*CFrame.new(0,-2,0)
  152.         local goal3 = {Size=Vector3.new(34.914, 1, 33.755)}
  153.         local goal4 = {Transparency=1}
  154.  
  155.         game:GetService("TweenService"):Create(spinningCircleVFX2,TweenInfo.new(0.15),goal3):Play()
  156.         game:GetService("TweenService"):Create(spinningCircleVFX2,TweenInfo.new(0.35),goal4):Play()
  157.         game:GetService("Debris"):AddItem(spinningCircleVFX2,0.35)
  158.         spawn(function()
  159.             while true do
  160.                 spinningCircleVFX2.Orientation=spinningCircleVFX2.Orientation+Vector3.new(0,-25,0)
  161.                 wait()
  162.             end
  163.         end)
  164.     end)
  165. end
  166. local function GuardBrokenVFX(enemy, player)
  167.     print("GUARD BROKEN")
  168.     if game.Players.LocalPlayer.Character:FindFirstChild("Sword") then
  169.  
  170.         local shockwaveVFX = game.ReplicatedStorage.InsertParts.Shockwave:Clone()
  171.         shockwaveVFX.Parent=enemy
  172.         shockwaveVFX.CFrame=enemy.HumanoidRootPart.CFrame*CFrame.Angles(0,0,3)*CFrame.new(0,-2,0)
  173.         spawn(function()
  174.             local sound = Instance.new("Sound",enemy.HumanoidRootPart)
  175.             sound.Name="SoundEffect"
  176.             sound:Play()
  177.             sound.SoundId="rbxassetid://7058511852"
  178.             game:GetService("Debris"):AddItem(sound,2)
  179.            
  180.             local spinningCircleVFX2 = game.ReplicatedStorage.InsertParts.SpinningCircle2:Clone()
  181.             spinningCircleVFX2.Parent=enemy
  182.             game:GetService("Debris"):AddItem(spinningCircleVFX2,0.45)
  183.             spinningCircleVFX2.CFrame=enemy.HumanoidRootPart.CFrame*CFrame.Angles(0,0,0)*CFrame.new(0,-2,0)
  184.             local goal3 = {Size=Vector3.new(38, 1, 42.6)}
  185.             local goal4 = {Transparency=1}
  186.  
  187.             game:GetService("TweenService"):Create(spinningCircleVFX2,TweenInfo.new(0.45),goal3):Play()
  188.             game:GetService("TweenService"):Create(spinningCircleVFX2,TweenInfo.new(0.45),goal4):Play()
  189.             game:GetService("Debris"):AddItem(spinningCircleVFX2,0.45)
  190.             while true do
  191.                 spinningCircleVFX2.Orientation=spinningCircleVFX2.Orientation+Vector3.new(0,-25,0)
  192.                 wait()
  193.             end
  194.            
  195.         end)
  196.         spawn(function()
  197.    
  198.            
  199.         end)
  200.         spawn(function()
  201.             if enemy.Name==game.Players.LocalPlayer.Name or player.Name==game.Players.LocalPlayer.Name then
  202.             game.Players.LocalPlayer.Character.Humanoid.CameraOffset=Vector3.new(0,0.1,0)
  203.             wait(0.025)
  204.             game.Players.LocalPlayer.Character.Humanoid.CameraOffset=Vector3.new(0,0,0)
  205.             wait(0.025)
  206.             game.Players.LocalPlayer.Character.Humanoid.CameraOffset=Vector3.new(0,-0.1,0)
  207.             wait(0.025)
  208.             game.Players.LocalPlayer.Character.Humanoid.CameraOffset=Vector3.new(0,0,0)
  209.                 wait(0.05)
  210.                 end
  211.             while true do
  212.                 shockwaveVFX.Orientation=shockwaveVFX.Orientation+Vector3.new(0,-25,0)
  213.                 wait()
  214.             end
  215.         end)
  216.         local goal = {Size=Vector3.new(38.175, 2.25, 42.905)}
  217.         local goal2 = {Transparency=1}
  218.  
  219.         game:GetService("TweenService"):Create(shockwaveVFX,TweenInfo.new(0.45),goal):Play()
  220.         game:GetService("TweenService"):Create(shockwaveVFX,TweenInfo.new(0.45),goal2):Play()
  221.         game:GetService("Debris"):AddItem(shockwaveVFX,0.45)
  222.         spawn(function()
  223.             local spinningCircleVFX = game.ReplicatedStorage.InsertParts.SpinningCircle:Clone()
  224.             spinningCircleVFX.Parent=enemy
  225.             game:GetService("Debris"):AddItem(spinningCircleVFX,0.45)
  226.             spinningCircleVFX.CFrame=enemy.HumanoidRootPart.CFrame*CFrame.Angles(0,0,0)*CFrame.new(0,0,0)
  227.             local goal = {Size=Vector3.new(20.775, 1.8, 21.505)}
  228.             local goal2 = {Transparency=1}
  229.  
  230.             game:GetService("TweenService"):Create(spinningCircleVFX,TweenInfo.new(0.45),goal):Play()
  231.             game:GetService("TweenService"):Create(spinningCircleVFX,TweenInfo.new(0.45),goal2):Play()
  232.             game:GetService("Debris"):AddItem(spinningCircleVFX,0.45)
  233.             while true do
  234.                 spinningCircleVFX.Orientation=spinningCircleVFX.Orientation+Vector3.new(0,-25,0)
  235.                 wait()
  236.             end
  237.        
  238.             end)
  239.     end
  240.  
  241. end
  242. local function WindVFXClient(enemy)
  243.     spawn(function()
  244.  
  245.         local windVFX = game.ReplicatedStorage.InsertParts.Wind:Clone()
  246.         windVFX.Parent=enemy
  247.         windVFX.CFrame=enemy.HumanoidRootPart.CFrame*CFrame.Angles(0,0,0)*CFrame.new(0,0,0)
  248.         spawn(function()
  249.             while true do
  250.                 windVFX.Orientation=windVFX.Orientation+Vector3.new(0,-25,0)
  251.                 wait()
  252.             end
  253.         end)
  254.         local goal = {Size=Vector3.new(1,1,1)}
  255.         local goal2 = {Transparency=1}
  256.  
  257.         game:GetService("TweenService"):Create(windVFX,TweenInfo.new(0.45),goal):Play()
  258.         game:GetService("TweenService"):Create(windVFX,TweenInfo.new(0.45),goal2):Play()
  259.         game:GetService("Debris"):AddItem(windVFX,0.45)
  260.  
  261.     end)
  262. end
  263.  
  264. function SlashVFX()
  265.     spawn(function()
  266.         if game.Players.LocalPlayer.Character:FindFirstChild("Sword") then
  267.             wait(0.2)
  268.             game.ReplicatedStorage.Remotes.VFXFunction:FireServer("Slash")
  269.             local slashVFX = game.ReplicatedStorage.InsertParts.SlashEffect:Clone()
  270.             slashVFX.Parent=game.Players.LocalPlayer.Character
  271.             slashVFX.CFrame=game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame*CFrame.Angles(0,0,0)*CFrame.new(0,0,-4)
  272.  
  273.             game:GetService("Debris"):AddItem(slashVFX,0.45)
  274.             local goal = {Size=Vector3.new(19.2, 0.473, 6.62)}
  275.             if Light==6 then
  276.                 goal =  {Size=Vector3.new(21, 0.873, 9.42)}
  277.             end
  278.             local goal2 = {Transparency=1}
  279.  
  280.             game:GetService("TweenService"):Create(slashVFX,TweenInfo.new(0.45),goal2):Play()
  281.             game:GetService("TweenService"):Create(slashVFX,TweenInfo.new(0.45),goal):Play()
  282.  
  283.             local slashVFX2 = game.ReplicatedStorage.InsertParts.SlashEffect2:Clone()
  284.             slashVFX2.Parent=game.Players.LocalPlayer.Character
  285.             slashVFX2.CFrame=game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame*CFrame.Angles(0,0,0)*CFrame.new(0,0.35,-4)
  286.  
  287.             game:GetService("Debris"):AddItem(slashVFX2,0.45)
  288.             local goal3 = {Size=Vector3.new(19.2, 0.473, 6.62)}
  289.             if Light==6 then
  290.                 goal3 =  {Size=Vector3.new(21, 0.873, 9.42)}
  291.             end
  292.             local goal4 = {Transparency=1}
  293.  
  294.             game:GetService("TweenService"):Create(slashVFX2,TweenInfo.new(0.45),goal3):Play()
  295.             game:GetService("TweenService"):Create(slashVFX2,TweenInfo.new(0.45),goal4):Play()
  296.         end
  297.     end)
  298. end
Advertisement
Add Comment
Please, Sign In to add comment