This script performs a points on kill reward. Somewhere after the (-3) test i get an 'attempt to index field 'Parent' (a nil value)' error and I have no idea how to fix it.
StatName = "Points"
IncreaseValue = 20
print("-1")--test
local Humanoid = script.Parent.Humanoid
print("-2")--test
function Killed()
print("-3")--test
local tag = Humanoid:findFirstChild("creator")
if tag ~= nil then
print("*4")--test
if tag.Value ~= nil then
print("1")--test
local Leaderstats = tag.Value:findFirstChild("leaderstats")
if Leaderstats ~= nil then
Leaderstats[StatName].Value = Leaderstats[StatName].Value + IncreaseValue
print("2")--test
wait(0.1)
print("3")--test
end
end
end
end
Humanoid.Died:connect(Killed)

2 comments
its failing on line 9
Bcause u ar an idiot lol