Shadowking_X

Yuji Server

Sep 26th, 2024
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.41 KB | None | 0 0
  1. local Tool = script.Parent
  2. local RS = game.ReplicatedStorage
  3. local RunService = game:GetService("RunService")
  4. local UniEvents = RS.UniversalEvents
  5. local Debris = game.Debris
  6. local CharacterFolder = RS.Characters
  7. local YujiFolder = CharacterFolder.Yuji
  8. local YujiEffects = YujiFolder.Effects
  9. local YujiEvents = YujiFolder.Events
  10. local YujiAnimations= YujiFolder.Animations
  11. local YujiSounds = YujiFolder.Sounds
  12. local YujiAccessories = YujiFolder.Accessories
  13. local TweenService = game:GetService("TweenService")
  14.  
  15. --
  16. local MaxCombo = 4
  17.  
  18. --Divergent Fist
  19. local DivergentFistOnCD = false
  20. local DivergentFistCDTime = 22
  21. local DivergentFistDuration = 10
  22.  
  23. --Black Flash
  24. local BlackFlashOnCD = false
  25. local BlackFlashCDTime = 30
  26.  
  27. --Transformation
  28. local TransformationPlaying = false
  29. local TransformationCDTime = 30
  30. local TransformationDuration = 15
  31. local TransformationOn = false
  32. local TransformationCD = false
  33.  
  34.  
  35. --Tool.Equipped:Connect(function()
  36.    
  37. --  ToolOn = true
  38.    
  39. --  local Character = Tool.Parent
  40.    
  41.    
  42.    
  43.    
  44. --end)
  45.  
  46. --Tool.Unequipped:Connect(function()
  47.    
  48. --  ToolOn = false
  49. --  FireLeft:Destroy()
  50. --  FireRight:Destroy()
  51.    
  52. --end)
  53.  
  54. local function UpdateCombo(Character)
  55.     local CurrentCombo = Character:GetAttribute("Combo")
  56.    
  57.     if CurrentCombo >= MaxCombo  then
  58.         Character:SetAttribute("Combo", 1)
  59.     else
  60.         Character:SetAttribute("Combo", CurrentCombo + 1)
  61.     end
  62.    
  63. end
  64.  
  65. local function StopAnimations(Humanoid, TrackName)
  66.     if TrackName ~= nil then
  67.         print("Stop ",TrackName)
  68.         for _, track in pairs(Humanoid:GetPlayingAnimationTracks()) do
  69.             if track == TrackName then
  70.                 track:Stop()
  71.                 return
  72.             end
  73.         end
  74.     else
  75.         print("Stop All")
  76.         for _, track in pairs(Humanoid:GetPlayingAnimationTracks()) do
  77.             track:Stop()
  78.         end
  79.     end
  80. end
  81.  
  82. local function TweenTransparency(Part,duration)
  83.     local duration = 2
  84.     local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
  85.     local goal = {Transparency = 1}
  86.     local tween = TweenService:Create(Part, tweenInfo, goal)
  87.     tween:Play()
  88.  
  89.     tween.Completed:Connect(function()
  90.  
  91.     end)
  92. end
  93.  
  94.  
  95.  
  96. local function VFXTweenRate(Particle,Duration)
  97.     local tweenInfo = TweenInfo.new(Duration, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
  98.     local properties = {Rate = 0}
  99.     local tween = TweenService:Create(Particle, tweenInfo, properties)
  100.     tween:Play()
  101.     tween.Completed:Connect(function()
  102.         task.wait(3)
  103.         Particle:Destroy()
  104.     end)
  105. end
  106.  
  107. local function AddBV(HumanoidRootPart,Strength, Duration)
  108.    
  109.     local BodyVelocity = Instance.new("BodyVelocity")
  110.     BodyVelocity.MaxForce = Vector3.new(1, 1, 1) * math.huge
  111.     BodyVelocity.Velocity = HumanoidRootPart.CFrame.LookVector * Strength
  112.     BodyVelocity.Parent = HumanoidRootPart
  113.  
  114.     game.Debris:AddItem(BodyVelocity, Duration)
  115. end
  116.    
  117.  
  118.  
  119.  
  120. UniEvents.Mouse1Attack.OnServerEvent:Connect(function(Player)
  121.     local Character = Player.Character
  122.    
  123.     local Humanoid = Character:WaitForChild("Humanoid")
  124.     local Animator = Humanoid:WaitForChild("Animator")
  125.     local AttackAnimation = YujiAnimations.Combat[tostring(Character:GetAttribute("Combo"))]
  126.     local AttackAnimationTrack = Animator:LoadAnimation(AttackAnimation)
  127.     local IsAttacking = Character:GetAttribute("IsAttacking")
  128.     local OrgWalkSpeed = Humanoid.WalkSpeed
  129.     local AttackWalkSpeed = 6
  130.    
  131.     if IsAttacking then return end
  132.    
  133.     Humanoid.WalkSpeed = AttackWalkSpeed
  134.     AttackAnimationTrack:Play()
  135.     Character:SetAttribute("IsAttacking", true)
  136.     AddBV(Character.HumanoidRootPart, 15, .5)
  137.    
  138.     AttackAnimationTrack.Stopped:Connect(function()
  139.         print("Animation Done")
  140.         UpdateCombo(Character)
  141.         Character:SetAttribute("IsAttacking", false)
  142.         Humanoid.WalkSpeed = OrgWalkSpeed
  143.     end)
  144.    
  145.     repeat wait()
  146.         print("wait")
  147.     until not Character:GetAttribute("IsAttacking")
  148.    
  149.    
  150. end)
  151.  
  152.  
  153. YujiEvents.DivergentFist.OnServerEvent:Connect(function(Player)
  154.    
  155.     local Character = Player.Character
  156.     local Humanoid = Character:WaitForChild("Humanoid")
  157.     local Animator = Humanoid:WaitForChild("Animator")
  158.     local DivergentFistAnimation = YujiAnimations.DivergentFistOnNew
  159.    
  160.     if TransformationOn then return end
  161.    
  162.     if not DivergentFistOnCD then
  163.         DivergentFistOnCD = true
  164.         local SkillAnimationTrack = Animator:LoadAnimation(DivergentFistAnimation)
  165.         local FireSound = YujiSounds.fire:Clone()
  166.         local VoiceSound = YujiSounds.GOJO:Clone()
  167.        
  168.         VoiceSound.Parent = Character
  169.         VoiceSound:Play()
  170.         Debris:AddItem(VoiceSound,3.8)
  171.        
  172.         UniEvents.DisableControls:FireClient(Player)
  173.         SkillAnimationTrack:Play()
  174.        
  175.         SkillAnimationTrack.KeyframeReached:Connect(function(KF)
  176.             if KF == "StartFire" then
  177.                
  178.                 local FireLeft = YujiFolder.Effects.FireLeft:Clone()
  179.                 local FireRight = YujiFolder.Effects.FireRight:Clone()
  180.                 FireLeft.Parent = Character["Left Arm"].LeftGripAttachment
  181.                 FireRight.Parent = Character["Right Arm"].RightGripAttachment
  182.                
  183.                 FireSound.Parent = Character
  184.                 FireSound:Play()
  185.                 Debris:AddItem(FireSound,5)
  186.                
  187.                
  188.                 repeat wait()
  189.  
  190.                 until not SkillAnimationTrack.IsPlaying
  191.                
  192.                
  193.                
  194.  
  195.                 UniEvents.EnableControls:FireClient(Player)
  196.  
  197.  
  198.                 local Counter = DivergentFistDuration
  199.                 repeat wait(1)
  200.                     Counter -= 1
  201.                 until Counter <= 0
  202.  
  203.                 print("Effect Over")
  204.                 FireLeft:Destroy()
  205.                 FireRight:Destroy()
  206.                
  207.  
  208.  
  209.                 local Counter = DivergentFistCDTime
  210.                 repeat wait(1)
  211.                     Counter -= 1
  212.                 until Counter <= 0
  213.  
  214.                 print("Cooldown Over")
  215.                 DivergentFistOnCD = false
  216.  
  217.  
  218.             end
  219.         end)   
  220.     end
  221. end)
  222.  
  223. YujiEvents.BlackFlashStart.OnServerEvent:Connect(function(Player)
  224.  
  225.     local Character = Player.Character
  226.     local Humanoid = Character:WaitForChild("Humanoid")
  227.     local Animator = Humanoid:WaitForChild("Animator")
  228.     local BlackFlashAnimation = YujiAnimations.BlackFlashStartPos
  229.     local PoseSound = YujiSounds.BlackFlashStart:Clone()
  230.    
  231.    
  232.    
  233.     if Character:GetAttribute("BlackFlash") or TransformationOn then return end
  234.    
  235.     if not BlackFlashOnCD then
  236.         Character:SetAttribute("BlackFlash", true)
  237.         BlackFlashOnCD = true
  238.         local SkillAnimationTrack = Animator:LoadAnimation(BlackFlashAnimation)
  239.         PoseSound.Parent = Character.Head
  240.         PoseSound:Play()
  241.         Debris:AddItem(PoseSound,2.5)
  242.        
  243.         UniEvents.DisableControls:FireClient(Player)
  244.         SkillAnimationTrack:Play()
  245.        
  246.  
  247.         SkillAnimationTrack.KeyframeReached:Connect(function(KF)
  248.             if KF == "Pause" then
  249.                 SkillAnimationTrack:AdjustSpeed(0)
  250.                 YujiEvents.BlackFlashPaused:FireClient(Player)
  251.             end
  252.         end)
  253.        
  254.         --SkillAnimationTrack.Stopped:Connect(function()
  255.         --  warn("Animation was not paused")
  256.         --end)
  257.        
  258.     end
  259.        
  260.    
  261. end)
  262.  
  263. YujiEvents.BlackFlash.OnServerEvent:Connect(function(Player, CFramePos)
  264.    
  265.    
  266.     local Character = Player.Character
  267.     Character.Archivable = true
  268.     local Humanoid = Character:WaitForChild("Humanoid")
  269.     local Animator = Humanoid:WaitForChild("Animator")
  270.     local PunchAnim = YujiAnimations.BlackFlashFinishPunch
  271.     local SkillAnimationTrack = Animator:LoadAnimation(PunchAnim)
  272.    
  273.     StopAnimations(Humanoid)
  274.    
  275.     local Clone = Character:Clone()
  276.     local CloneHumanoid = Clone:WaitForChild("Humanoid")
  277.     local CloneAnimator = CloneHumanoid:WaitForChild("Animator")
  278.     local PausedBlackFlashAnimation = YujiAnimations.BlackFlashPaused
  279.     local BlackFlashSound = YujiSounds.BlackFlash:Clone()
  280.     BlackFlashSound.Parent = Character.HumanoidRootPart
  281.    
  282.    
  283.     for _, Part in pairs(Clone:GetChildren()) do
  284.         if Part:IsA("BasePart") then
  285.             Part.CollisionGroup = "Clone"
  286.         end
  287.     end
  288.    
  289.     Clone.Parent = workspace
  290.     Clone.HumanoidRootPart.CFrame = Player.Character.HumanoidRootPart.CFrame
  291.     local CloneSkillAnimationTrack = CloneAnimator:LoadAnimation(PausedBlackFlashAnimation)
  292.     CloneSkillAnimationTrack:Play()
  293.     SkillAnimationTrack:Play()
  294.     BlackFlashSound:Play()
  295.    
  296.    
  297.     SkillAnimationTrack.KeyframeReached:Connect(function(KF)
  298.         if KF == "PunchEnd" then
  299.             wait(1)
  300.            
  301.             for i,v in pairs(Clone:GetDescendants()) do
  302.                 if v:IsA("BasePart") or v:IsA("Part") then
  303.                     TweenTransparency(v,2)
  304.                 elseif v:IsA("Decal") then
  305.                     TweenTransparency(v,2)
  306.                 end
  307.             end
  308.            
  309.             wait(4)
  310.             Clone:Destroy()
  311.         end
  312.     end)
  313.  
  314.    
  315.     local BlackLightning = YujiEffects.BlackLightning:Clone()
  316.     local BlackLightHand = YujiEffects.BlackLightningHand:Clone()
  317.     local RedLightning = YujiEffects.RedLightning:Clone()
  318.     local RedLightHand = YujiEffects.RedLightningHand:Clone()
  319.    
  320.    
  321.     BlackLightHand.Parent = Character["Right Arm"].RightGripAttachment
  322.     BlackLightning.Parent = Character.HumanoidRootPart
  323.     RedLightHand.Parent = Character["Right Arm"].RightGripAttachment
  324.     RedLightning.Parent = Character.HumanoidRootPart
  325.    
  326.     Character.HumanoidRootPart.CFrame = CFramePos
  327.    
  328.     task.wait(1)
  329.     VFXTweenRate(BlackLightning, 2)
  330.     VFXTweenRate(BlackLightHand, .5)
  331.     VFXTweenRate(RedLightning, 2)
  332.     VFXTweenRate(RedLightHand, .5)
  333.    
  334.  
  335.    
  336.     UniEvents.EnableControls:FireClient(Player)
  337.    
  338.     local Counter = BlackFlashCDTime
  339.     repeat task.wait(1)
  340.         Counter -= 1
  341.     until Counter <= 0
  342.     BlackFlashOnCD = false
  343.     Character:SetAttribute("BlackFlash", false)
  344.    
  345.    
  346. end)
  347.  
  348.  
  349. YujiEvents.Transform.OnServerEvent:Connect(function(Player)
  350.     local Character = Player.Character
  351.     local Humanoid = Character:WaitForChild("Humanoid")
  352.     local Animator = Humanoid:WaitForChild("Animator")
  353.     local TransformAnimation = YujiAnimations.TransformationCimatic
  354.     local SkillAnimationTrack = Animator:LoadAnimation(TransformAnimation)
  355.    
  356.     if TransformationPlaying or TransformationCD then return end
  357.    
  358.     TransformationOn = true
  359.     TransformationCD = true
  360.    
  361.     local SukunaSpeech = YujiSounds.SukunaTransformOpen:Clone()
  362.     SukunaSpeech.Parent = Character.Head
  363.     SukunaSpeech:Play()
  364.     Debris:AddItem(SukunaSpeech,6)
  365.     local SmokeEffect = YujiEffects.Smoke:Clone()
  366.     SmokeEffect.Parent = Character.HumanoidRootPart.RootAttachment
  367.    
  368.     local RageHead = YujiAccessories.YujiRageHead:Clone()
  369.     if Character:FindFirstChild("YujiRegularHead") then
  370.         Character.YujiRegularHead:Destroy()
  371.     end
  372.     if Character:FindFirstChild("SukunaHead") then
  373.         Character.SukunaHead:Destroy()
  374.     end
  375.    
  376.     RageHead.Parent = Character
  377.    
  378.    
  379.     TransformationPlaying = true
  380.     UniEvents.DisableControls:FireClient(Player)
  381.     SkillAnimationTrack:Play()
  382.     YujiEvents.Transform:FireClient(Player)
  383.    
  384.    
  385.     SkillAnimationTrack:GetMarkerReachedSignal("CameraShake"):Connect(function()
  386.         UniEvents.ScreenShakeEvent:FireClient(Player)
  387.        
  388.         local WooshSound = YujiSounds.Woosh:Clone()
  389.         WooshSound.Parent = Character["Right Arm"]
  390.         WooshSound:Play()
  391.         Debris:AddItem(WooshSound,2)
  392.         local SukunaHead = YujiAccessories.SukunaHead:Clone()
  393.         SukunaHead.Parent = Character
  394.         RageHead.Handle.Transparency = 1
  395.         repeat task.wait()
  396.            
  397.         until Character:FindFirstChild("SukunaHead")
  398.        
  399.         RageHead:Destroy()
  400.        
  401.     end)
  402.    
  403.    
  404.     repeat task.wait()
  405.     until not SkillAnimationTrack.IsPlaying
  406.     SmokeEffect:Destroy()
  407.     UniEvents.EnableControls:FireClient(Player)
  408.     TransformationPlaying = false  
  409.    
  410.     task.wait(TransformationDuration)
  411.    
  412.     local TransformEndAnimation = YujiAnimations.TransformEnd
  413.     local SkillEndAnimationTrack = Animator:LoadAnimation(TransformEndAnimation)
  414.     SkillEndAnimationTrack:Play()
  415.     UniEvents.DisableControls:FireClient(Player)
  416.    
  417.     SkillEndAnimationTrack.KeyframeReached:Connect(function(KF)
  418.         if KF == "ChangeFace" then
  419.             local NormalHead = YujiAccessories.YujiRegularHead:Clone()
  420.             NormalHead.Parent = Character
  421.             Character:FindFirstChild("SukunaHead"):Destroy()
  422.         end
  423.     end)
  424.    
  425.     repeat task.wait()
  426.     until not SkillEndAnimationTrack.IsPlaying
  427.    
  428.     UniEvents.EnableControls:FireClient(Player)
  429.     TransformationOn = false
  430.     task.wait(TransformationCDTime)
  431.     TransformationCD = false
  432.    
  433. end)
Advertisement
Add Comment
Please, Sign In to add comment