Cakey3101

Earthsplitter Ability

Sep 3rd, 2025
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.48 KB | Source Code | 0 0
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  2. local Workspace = game:GetService("Workspace")
  3. local SoundService = game:GetService("SoundService")
  4.  
  5. local ApplyKnockback = require(ReplicatedStorage:WaitForChild("Modules"):WaitForChild("ApplyKnockBack"))
  6. local ApplyDamage = require(ReplicatedStorage:WaitForChild("Modules"):WaitForChild("ApplyDamage"))
  7. local StunModule = require(ReplicatedStorage:WaitForChild("Modules"):WaitForChild("StunModule"))
  8. local RocksModule = require(ReplicatedStorage:WaitForChild("Modules"):WaitForChild("RocksModule"))
  9. local HitboxModule = require(ReplicatedStorage:WaitForChild("Modules"):WaitForChild("HitboxModule"))
  10. local CharModule = require(ReplicatedStorage:WaitForChild("Modules"):WaitForChild("CharacterModule"):WaitForChild("Characters"):WaitForChild("Sword Master"))
  11.  
  12. local Remotes = ReplicatedStorage:WaitForChild("Remotes")
  13.  
  14. local function ApplyHitEffects(Target: Model, Player: Player, Damage: number, HitNumber: number)
  15.     if HitNumber < 3 then
  16.         local HitDamage = Damage * 0.25
  17.         ApplyDamage.ApplyDamage(Player, Target, HitDamage)
  18.         StunModule.StunFor(Target, 2)
  19.     else
  20.         local HitDamage = Damage * 0.5
  21.         ApplyDamage.ApplyDamage(Player, Target, HitDamage)
  22.        
  23.         local Knockback = ApplyKnockback.new(Target, Player.Character, 5, 5)
  24.         Knockback:Construct()
  25.     end
  26. end
  27.  
  28. return function(Player: Player, AbilityData)
  29.     local Name = AbilityData.Name
  30.     local Damage = AbilityData.Damage
  31.     local Cooldown = AbilityData.Cooldown
  32.     local Hitbox = AbilityData.Hitbox
  33.     local HitboxDelay = AbilityData.HitboxDelay
  34.     local Animation = AbilityData.Animation
  35.  
  36.     local Character = Player.Character
  37.     local HRP: BasePart = Character:FindFirstChild("HumanoidRootPart")
  38.     local Humanoid: Humanoid = Character:FindFirstChild("Humanoid")
  39.     local OriginalWS = Humanoid.WalkSpeed
  40.     Humanoid.WalkSpeed = 0
  41.  
  42.     task.delay(0.5, function()
  43.         local HitPosition = Character.PrimaryPart.Position
  44.        
  45.         local Anim = Instance.new("Animation")
  46.         Anim.AnimationId = `rbxassetid://{Animation}`
  47.  
  48.         local AnimTrack = Humanoid:FindFirstChildOfClass("Animator"):LoadAnimation(Anim)
  49.        
  50.         for HitNumber = 1, 3 do
  51.             AnimTrack:Play()
  52.            
  53.             AnimTrack.Stopped:Wait()
  54.            
  55.             local StoneSize = Vector3.new(3, 3, 3)
  56.             local StoneAmount = 8
  57.             local Radius = 15
  58.            
  59.             if HitNumber == 1 then
  60.                 StoneSize = Vector3.new(2, 2, 2)
  61.                 Radius = 5
  62.                 local StoneAmount = 4
  63.             elseif HitNumber == 2 then
  64.                 StoneSize = Vector3.new(2, 2, 2)
  65.                 Radius = 10
  66.                 local StoneAmount = 6
  67.             end
  68.            
  69.             Remotes.CamShake:FireClient(Player, "SmallExplosion")
  70.             Remotes.PlaySound:FireClient(Player, "Earthsplitter", HRP)
  71.             RocksModule.Ground(HitPosition, Radius, StoneSize, {Player.Character, Workspace.Dummys.Blocking, Workspace.Dummys.Dummy}, 8, false, 5)
  72.            
  73.            
  74.             for _, Enemy in pairs(Workspace:GetChildren()) do
  75.                 if Enemy:IsA("Model") and Enemy:FindFirstChildOfClass("Humanoid") then
  76.                     local Distance = (Enemy.PrimaryPart.Position - HitPosition).Magnitude
  77.                     if Distance <= Radius and Enemy ~= Player.Character then
  78.                         ApplyHitEffects(Enemy, Player, Damage, HitNumber)
  79.                     end
  80.                 end
  81.             end
  82.            
  83.             for _, Dummy in pairs(Workspace.Dummys:GetChildren()) do
  84.                 if Dummy:IsA("Model") and Dummy:FindFirstChildOfClass("Humanoid") then
  85.                     local Distance = (Dummy.PrimaryPart.Position - HitPosition).Magnitude
  86.                     if Distance <= Radius then
  87.                         ApplyHitEffects(Dummy, Player, Damage, HitNumber)
  88.                     end
  89.                 end
  90.             end
  91.         end
  92.     end)
  93.    
  94.     Humanoid.WalkSpeed = OriginalWS
  95. end
Advertisement
Add Comment
Please, Sign In to add comment