What my script is supposed to do is change an IntValue when it is killed.
This is a regular script in my NPC model, and my NPC uses a Humanoid. All of the paths are correct as well.
The script doesn’t seem to run, heres the code:
local character = script.Parent
local value = workspace.NPCsKilled
character:WaitForChild("Humanoid").Died:Connect(function()
value.Value = value.Value + 1
print(character.Name .. " has died!")
end)
while wait() do
local character = script.Parent
if character.Humanoid.Health <= 0 then
local value = workspace.NPCsKilled
value = value + 1
print(character.Name .. " has died!")
end
end
local character = script.Parent
local Kills = workspace.NPCsKilled
if character.Humanoid.Health <= 0 then
Kills.Value = Kills.Value + 1
print(character.Name .. " has died!")
end
end
local character = script.Parent
local Kills = workspace.NPCsKilled
if character.Humanoid.Health <= 0 then
Kills.Value = Kills.Value + 1
print(character.Name .. " has died!")
end