It suppose to fire when the humanoid is damaged. When fired it goes into cooldown and the Cooldown script enables it again after some time.
I put this in the player to make it work but it just doesn’t. When damaged it did nothing and I can’t find any errors.
I also tried in an NPC but results the same.
hit.Parent:FindFirstChild(“Kick”) is for the explosion to ignore the player
human = script.Parent.Humanoid
CurrentHealth = human.Health
human.HealthChanged:connect(function(Health)
if human.Health < CurrentHealth then
wait(0.01)
--local blockchance = math.random(6,10)
--if blockchance == 10 then
local SFX = script.Explode:Play()
local EX = Instance.new("Explosion")
EX.DestroyJointRadiusPercent = 0
EX.Parent = script.Parent
EX.Position = script.Parent.Torso.Position
EX.BlastPressure = 0
EX.BlastRadius = 5
EX.Hit:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil and not hit.Parent:FindFirstChild("Kick") then
hit.Parent:FindFirstChild("Humanoid"):TakeDamage(1)
script.Parent.Enabled = false
script.Cooldown.Enabled = true
end
end)
--else
--end
end
end)
This is the Cooldown script
while wait(3) do
script.Parent.Enabled = true
script.Disabled = true
end
Anything helps thumbs up
Edit: ok I actually fixed it worked by myself so yeah