Error happens at line 33, don’t know what is causing it or what its doing, but the players hit by explosions wont take damage for some reason ![]()
local evnt = script.Parent.Evnt
local Tool = script.Parent
local ESPUMA = Tool.Handle.ESPUMA
local Handle = Tool.Handle
Players = game:GetService("Players")
Debris = game:GetService("Debris")
local modelsHit = {}
script.Parent.Equipped:Connect(function()
script.Parent.Handle.OpenSound:Play()
script.Parent.Parent.Humanoid.WalkSpeed = 20
end)
evnt.OnServerEvent:Connect(function()
Tool.Enabled = false
ESPUMA:Play()
wait(2.01)
Explosion = Instance.new("Explosion")
Explosion.ExplosionType = Enum.ExplosionType.NoCraters
Explosion.BlastRadius = 4
Explosion.BlastPressure = 1000000
Explosion.Position = Handle.Position
Explosion.Parent = game:GetService("Workspace")
Explosion.DestroyJointRadiusPercent = 0
wait(0.1)
Tool.Parent = game:GetService("Workspace")
Tool.Enabled = true
end)
Explosion.Hit:Connect(function(part, distance)
local parentModel = part.Parent
if parentModel then
-- check to see if this model has already been hit
if modelsHit[parentModel] then
local HitHumanoid = parentModel:FindFirstChild("Humanoid")
return
end
modelsHit[parentModel] = true
-- look for a humanoid
local character = script.Parent.Parent
parentModel = part.Hit.Parent
local humanoid = character:FindFirstChildOfClass("Humanoid")
local plr = Players:GetPlayerFromCharacter(character)
local HitHumanoid = parentModel:FindFirstChild("Humanoid")
local tStatus = HitHumanoid.Status
local targetStats = tStatus.DamageStats
local damage = 140
if HitHumanoid then
local statsNew = Instance.new("BoolValue")
statsNew.Name = #targetStats:GetChildren()
local tag = Instance.new("IntValue")
tag.Value = damage
tag.Name = "DamageDealt"
tag.Parent = statsNew
local tag2 = Instance.new("ObjectValue")
tag2.Value = plr
tag2.Name = "Attacker"
tag2.Parent = statsNew
local tag3 = Instance.new("Vector3Value")
tag3.Value = plr.Character.HumanoidRootPart.Position
tag3.Name = "AttackerPosition"
tag3.Parent = statsNew
statsNew.Parent = targetStats
--get and set current knife kill effect
local tag4 = Instance.new("StringValue")
tag4.Value = "HighForce"
tag4.Name = "KillEffect"
tag4.Parent = statsNew
--get and set current knife kill effect
local tag5 = Instance.new("NumberValue")
tag5.Name = "SecondaryHit"
tag5.Value = 1/2
tag5.Parent = statsNew
HitHumanoid:TakeDamage(damage)
end
end
end)
local evnt = script.Parent.Evnt
local Tool = script.Parent
local ESPUMA = Tool.Handle.ESPUMA
local Handle = Tool.Handle
Players = game:GetService("Players")
Debris = game:GetService("Debris")
local modelsHit = {}
script.Parent.Equipped:Connect(function()
script.Parent.Handle.OpenSound:Play()
script.Parent.Parent.Humanoid.WalkSpeed = 20
end)
evnt.OnServerEvent:Connect(function()
Tool.Enabled = false
ESPUMA:Play()
wait(2.01)
Explosion = Instance.new("Explosion")
Explosion.ExplosionType = Enum.ExplosionType.NoCraters
Explosion.BlastRadius = 4
Explosion.BlastPressure = 1000000
Explosion.Position = Handle.Position
Explosion.Parent = game:GetService("Workspace")
Explosion.DestroyJointRadiusPercent = 0
wait(0.1)
Tool.Parent = game:GetService("Workspace")
Tool.Enabled = true
end)
Explosion.Hit:Connect(function(part, distance)
local parentModel = part.Parent
if parentModel then
-- check to see if this model has already been hit
if modelsHit[parentModel] then
local HitHumanoid = parentModel:FindFirstChild("Humanoid")
return
end
modelsHit[parentModel] = true
-- look for a humanoid
local character = script.Parent.Parent
parentModel = part.Hit.Parent
local humanoid = character:FindFirstChildOfClass("Humanoid")
local plr = Players:GetPlayerFromCharacter(character)
local HitHumanoid = parentModel:FindFirstChild("Humanoid")
local tStatus = HitHumanoid.Status
local targetStats = tStatus.DamageStats
local damage = 140
if HitHumanoid then
local statsNew = Instance.new("BoolValue")
statsNew.Name = #targetStats:GetChildren()
local tag = Instance.new("IntValue")
tag.Value = damage
tag.Name = "DamageDealt"
tag.Parent = statsNew
local tag2 = Instance.new("ObjectValue")
tag2.Value = plr
tag2.Name = "Attacker"
tag2.Parent = statsNew
local tag3 = Instance.new("Vector3Value")
tag3.Value = plr.Character.HumanoidRootPart.Position
tag3.Name = "AttackerPosition"
tag3.Parent = statsNew
statsNew.Parent = targetStats
--get and set current knife kill effect
local tag4 = Instance.new("StringValue")
tag4.Value = "HighForce"
tag4.Name = "KillEffect"
tag4.Parent = statsNew
--get and set current knife kill effect
local tag5 = Instance.new("NumberValue")
tag5.Name = "SecondaryHit"
tag5.Value = 1/2
tag5.Parent = statsNew
HitHumanoid:TakeDamage(damage)
end
end
end)