Server Script:
local char = script.Parent
local hum = char:WaitForChild("Humanoid")
local plr = game.Players:GetPlayerFromCharacter(char)
local plrstats = plr:WaitForChild("leaderstats")
local plrcurrentkills = plrstats:WaitForChild("Current Kills")
hum.Died:Connect(function()
plrcurrentkills.Value = 0
for i,v in pairs(char:GetChildren()) do
if v:IsA("IntValue") then
local newplr = game.Players:FindFirstChild(v.Name) --clearly defines what "newplr" is
local newplrstats = newplr:FindFirstChild("leaderstats") --error occurs here saying that newplr is nil
local newplrcurrentkills = newplrstats:FindFirstChild("Current Kills")
local newplrkills = newplrstats:FindFirstChild("Kills")
newplrkills.Value = newplrkills.Value + 1
newplrcurrentkills.Value = newplrcurrentkills.Value + 1
end
end
end)
The script is placed in the StarterCharacterScripts. I already set up an IntValue to be checked to reward the killer. An error happens stating that "newplr" is nil when my script clearly says what that variable is. Is this an error relating to the limits of a Server Script accessing a player's leaderboard values? I tested this in a local script and I got the same results.

1 comment
v.Name of an IntValue inserted through a script is a name of a player that changes through a damage script in a tool. Line 9 is just finding the IntValue inside the character.