The title basically explains the issue but I’ll go into more detail.
I’m making a system where when the NPC dies it will give certain stats and then the players damage will also be buffed but the issue is when the player does enough damage to instantly kill the NPC the Died event wont fire.
The event only seems to fire when the player doesn’t instantly kill the NPC
local function NewNormalDummy(Dummy)
Dummy.Humanoid.Died:Connect(function()
local creator = Dummy.Humanoid:FindFirstChild("creator")
if creator then
local Modelplr = creator.Value
local plr = game.Players:GetPlayerFromCharacter(Modelplr)
local Data = DataStore.GetData(plr)
local Boost = (25 * Data["Prestige"])
local Text = "Str"
if Data["Strength"] >= 50 then
if Boost ~= 0 then
DataStore.UpdateData(plr, "Strength", Boost)
Ui:FireClient(plr, Text, Boost)
end
end
creator:Destroy()
end
local OldCFrame = Dummy.HumanoidRootPart.CFrame
wait(1)
Dummy:Destroy()
local NewDummy = game.ServerStorage.Dummies["Normal Dummy"]:Clone()
NewDummy.HumanoidRootPart.CFrame = OldCFrame
NewDummy.Parent = game.Workspace.Dummies["Normal Dummies"]
NewNormalDummy(NewDummy)
end)
end
For those wondering I’ve already assigned the same Died event to the first dummy and then it will call the function above causing an endless loop of the function being called everytime the dummy dies.