So I am coding a game where on an NPC's death, The player's kills score goes up by 1 but there seems to be an error when I fix it all the time. It's either an 'Attempted to add Instance and Number' or 'Attempt to index number with 'Value'' Here is the code for you below (please note that the script is the NPC's Child.)
--code below --
enemies_killed = game.StarterGui["Enemies Defeated"].Frame.enemydefeatednum.enemies_killed
print(dead_bool)
NPC_died = 0
while true do
wait(0.1)
if script.Parent.Humanoid ~= nil then
if script.Parent.Humanoid.Health <= 0 then
NPC_died += 1
dead_bool = true
enemies_killed = enemies_killed.Value + 1
print(enemies_killed)
wait(0.1)
end
end
end