Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

The function won't run despite being linked to an event that is definitely happening?

Asked by 3 years ago
Edited 3 years ago
local Dummy = script.Parent
local Humanoid = Dummy.Humanoid
local ThoseWhoDamaged = Dummy.ThoseWhoDamaged
local XPReward = Dummy.XPReward

Humanoid.Died:Connect(function()
    print("Dummy Died, giving rewards")
    for i, v in pairs(ThoseWhoDamaged:GetChildren()) do
        game.ReplicatedStorage.RewardXP:FireClient(v.Value, XPReward.Value)
    end
end)

This function is suppose to run when the humanoid dies, however, it does not. It's in a regular script in workspace. Why is this happening?

edit:

I made some changed to the script and it's magically working now, despite the fact that I changed nothing regarding where the script was located or how the function ran. Whatever though, it works now.

edit (again)

Turns out it is unreliable. It doesn't always fire when the humanoid dies.

0
And no, the dummy is not getting deleted on death. The only thing changing is the humanoids health eyeball001 7 — 3y
0
May I ask more details about 'ThoseWhoDamaged'? DiamondComplex 285 — 3y
0
Its a folder in the Dummy. I use it to keep track of those who did damage eyeball001 7 — 3y

Answer this question