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:
local Humanoid = script.Parent.Humanoid local Torso = script.Parent.Torso function HasDied() local player = game.Players.LocalPlayer local tag = Torso:findFirstChild("Tag") if tag ~= nil then print("PassedTest1") if tag.Value ~= nil then print("PassedTest2") player.leaderstats1.Ryo.Value = player.leaderstats1.Ryo.Value + 999 player.leaderstats1.XP.Value = player.leaderstats1.XP.Value + math.random(50,200) wait(0.1) script:remove() end end end 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.