Advertisement
TaylorsRus

ThunderClap

Mar 9th, 2023
626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.07 KB | None | 0 0
  1. local ThunderClap = {}
  2.  
  3. local DISTANCE_FLASHED = 50
  4. local DELAY = 2
  5.  
  6. local HITBOX_SIZE = Vector3.new(10, 10, DISTANCE_FLASHED + 5)
  7. local HITBOX_LIFE = DELAY + .3
  8. local ATTACHMENT_SIZE = Vector3.one
  9.  
  10. local function ToggleStats(self, Player, Type)
  11.     local Humanoid = Player.Character:FindFirstChild("Humanoid")
  12.    
  13.     local Data = {
  14.         [true] = {
  15.             Freeze = true,
  16.             Look = false,
  17.             AutoRotate = false,
  18.             WalkSpeed = 0
  19.         },
  20.         [false] = {
  21.             Freeze = false,
  22.             Look = true,
  23.             AutoRotate = true,
  24.             WalkSpeed = self.DataStore:GetData(Player, "WalkSpeed")
  25.         }
  26.     }
  27.    
  28.     local GivenTable = Data[Type]
  29.  
  30.     self.DataStore:SetData(Player, "Freeze", GivenTable.Freeze)
  31.     self.DataStore:SetData(Player, "Look", GivenTable.Look)
  32.     Humanoid.AutoRotate = GivenTable.AutoRotate
  33.     Humanoid.WalkSpeed = GivenTable.WalkSpeed
  34. end
  35.  
  36. ThunderClap.Hit = {
  37.     Damage = 10,
  38.     Stamina = 0,
  39.     Blockable = false,
  40. }
  41.  
  42. function ThunderClap:HitEffects(Attacker, Victim, Hitbox)
  43.     local HumRP = Victim:FindFirstChild("HumanoidRootPart")
  44.    
  45.     HumRP.AssemblyLinearVelocity = Hitbox.CFrame.LookVector * 10
  46.    
  47.     self.Physics:Ragdoll(Victim, 3)
  48. end
  49.  
  50. function ThunderClap:FireSkill(Player)
  51.     local Character = Player.Character
  52.     local Humanoid, HumRP = Character:FindFirstChild("Humanoid"), Character:FindFirstChild("HumanoidRootPart")
  53.    
  54.     local StartPosition = HumRP.Position
  55.     local EndPosition = HumRP.Position + HumRP.CFrame.LookVector * DISTANCE_FLASHED
  56.     local MiddlePosition = (StartPosition + EndPosition) / 2
  57.    
  58.     local Thunder = HumRP:FindFirstChild("Thunder")
  59.     local Dust = script:FindFirstChild("DustEffect"):Clone()
  60.    
  61.     local HitboxArgs = {Size = HITBOX_SIZE, Life = HITBOX_LIFE, Lineage = script, Attacker = Character}
  62.     local BoltAttachments = {}
  63.  
  64.     local Hitbox = self.Shared:CreateHitbox(Character, HitboxArgs)
  65.     HitboxArgs.Color = Color3.new(0, 0, 0)
  66.     HitboxArgs.Size = HITBOX_SIZE
  67.    
  68.     local DustEmission = self.Shared:CreatePart(StartPosition + Vector3.new(0, .5, 0))
  69.     Dust.Parent = DustEmission
  70.    
  71.     for Counter = 1, 2 do
  72.         BoltAttachments["Attach"..tostring(Counter)] = self.Shared:CreatePart()
  73.     end
  74.    
  75.     Hitbox.Position = MiddlePosition
  76.     Hitbox.CFrame = CFrame.lookAt(Hitbox.Position, EndPosition)
  77.     --self.Shared:CreateWeld(Hitbox, HumRP)
  78.     BoltAttachments["Attach1"].Position = StartPosition
  79.     BoltAttachments["Attach2"].Position = EndPosition
  80.  
  81.     -- Pre-Thunder Clap
  82.     print("Charging..")
  83.     ToggleStats(self, Player, true)
  84.     task.wait(DELAY / 2)
  85.    
  86.     --Just-Before Thunder Clap
  87.     self["Effects"].Rubble:CreateRubble(3, Character)
  88.     task.wait(DELAY / 4)
  89.    
  90.     -- Thunder Clap
  91.     print("Thunder Clap and FLash! Re-cooperating..")
  92.    
  93.     Hitbox.Parent = workspace
  94.     Dust:Emit(40)
  95.    
  96.     for Name, Part in pairs(BoltAttachments) do
  97.         local Attachment = Instance.new("Attachment")
  98.         Attachment.Name = Part.Name.."Attach"
  99.         Attachment.Parent = Part
  100.        
  101.         Part.Parent = workspace
  102.        
  103.         BoltAttachments[Name] = Attachment
  104.     end
  105.    
  106.     local BlueBoltSettings = {
  107.         Attach1 = BoltAttachments.Attach1,
  108.         Attach2 = BoltAttachments.Attach2,
  109.         PartCount = 50,
  110.         CurveSize0 = math.random(10, 15),
  111.         CurveSize1 = math.random(10, 15),
  112.         PulseSpeed = math.random(5, 10),
  113.         PulseLength = 1,
  114.         FadeLength = .1,
  115.         MaxRadius = 2,
  116.         Color = Color3.new(0.0901961, 0.72549, 1)
  117.     }
  118.    
  119.     local YellowBoltSettings = {
  120.         Attach1 = BoltAttachments.Attach1,
  121.         Attach2 = BoltAttachments.Attach2,
  122.         PartCount = 50,
  123.         CurveSize0 = math.random(15, 20),
  124.         CurveSize1 = math.random(15, 20),
  125.         PulseSpeed = math.random(5, 10),
  126.         PulseLength = 1,
  127.         FadeLength = .1,
  128.         MaxRadius = 10,
  129.         Color = Color3.new(0.807843, 1, 0.184314)
  130.     }
  131.    
  132.     self.Shared:CreateBolt(BlueBoltSettings)
  133.     self.Shared:CreateBolt(YellowBoltSettings)
  134.     self.Shared:CreateBolt(YellowBoltSettings)
  135.    
  136.     Thunder:Play()
  137.     self.Shared:PlayTween(HumRP, TweenInfo.new(.1 , Enum.EasingStyle.Quart), {Position = EndPosition})
  138.     self.Shared["ClientServer"]:FireClient(Player, "CameraHandler", "ShakeCamera", "Explosion")
  139.    
  140.     --Post Thunder Clap
  141.     task.wait(DELAY)
  142.     ToggleStats(self, Player, false)
  143.     print("Finished.")
  144.    
  145.     task.wait(2)
  146.    
  147.     self.Physics:Ragdoll(Character, true)
  148. end
  149.  
  150. return ThunderClap
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement