Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RepStorage = game:GetService("ReplicatedStorage")
- local Modules = RepStorage:WaitForChild("Modules")
- local HitboxModule = require(Modules:WaitForChild("HitboxModule"))
- local Ragdoll = require(Modules:WaitForChild("RagdollModule"))
- local PlayerData = require(Modules.Data:WaitForChild("PlayerData"))
- local DamageController = {}
- function DamageController:DamageHumanoid(Char, DamageTable)
- if not Char:IsDescendantOf(workspace:WaitForChild("LivingThings")) or Char.Humanoid.Health < 1 then
- return
- end
- local Hum, HumRP = Char:WaitForChild("Humanoid"), Char:WaitForChild("HumanoidRootPart")
- --local EnemyHum, EnemyRP = Char:WaitForChild("Humanoid"), Char:WaitForChild("HumanoidRootPart")
- local Damage = DamageTable[1]
- local BlockBreak = DamageTable[2]
- local DataIndex = PlayerData.Stats[Char:GetAttribute("Type")]
- local BLOCK_PARTICLE_EMITTION = 30
- if Char:GetAttribute("Blocking") then
- if not BlockBreak then
- local BlockSound = HumRP:WaitForChild("BlockSound")
- local BlockParticle = HumRP:WaitForChild("BlockParticle")
- BlockSound:Play()
- BlockParticle:Emit(BLOCK_PARTICLE_EMITTION)
- else
- local BlockBreakSound = HumRP:WaitForChild("BlockBreakSound")
- BlockBreakSound:Play()
- Char:SetAttribute("Blocking", false)
- Char:SetAttribute("MechanicsDisable", true)
- Hum.WalkSpeed = 0
- task.wait(1.65)
- Char:SetAttribute("MechanicsDisable", false)
- Hum.WalkSpeed = DataIndex.WalkSpeed
- end
- else
- Hum:TakeDamage(Damage)
- end
- end
- return DamageController
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement