So when I do an "if" statement, which dose not work, it wont give me + 5 in value towards the NumberValue found in Replicated storage Example:
local Cash = game.ReplicatedStorage:WaitForChild("NumberValue") local HP = script.Parent.Health
end)
now NumberValue is my Value I call "cash", and I need when the Humanoid his <= 0 then will give + 5 value once.
I dont want an if statement but more of a way to figure this out
Conclusion NumberValue is added 5 every time the humanoid dies (hits 0 Health)
Thanks For your awnsers!
You could use a function to detect when a player has died
local Cash = game.ReplicatedStorage:WaitForChild("NumberValue") game:GetService('Players').PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) character:WaitForChild("Humanoid").Died:connect(function() Cash.Value = Cash.Value + 5 end) end) end)
Accept answer if helped and tell me if anything is wrong!