Enemy on Died:connect rewards not being rewarded after dying?
I'm attempting to give the player rewards for defeating enemies, but for whatever reason the script doesn't reward the player at all.
This is a LocalScript:
01 | local Humanoid = script.Parent.Humanoid |
02 | local Torso = script.Parent.Torso |
04 | local player = game.Players.LocalPlayer |
05 | local tag = Torso:findFirstChild( "Tag" ) |
08 | if tag.Value ~ = nil then |
10 | player.leaderstats 1. Ryo.Value = player.leaderstats 1. Ryo.Value + 999 |
11 | player.leaderstats 1. XP.Value = player.leaderstats 1. XP.Value + math.random( 50 , 200 ) |
17 | Humanoid.Died:connect(HasDied) |
The Tag is not nil, and is destroyed 5 seconds after being created. Each time an enemy, or any humanoid with a torso gets hit(And yes the enemies have their Torso named 'Torso') The hit target gets a StringValue in their Torso named 'Tag'. This StringValue's value is the name of the player who hit the enemy.
There is no error in the output, and no message from the prints.