I was running some testing in my local server with just 2 players, and I've been getting this error for some players. This script works perfectly fine for solo testing, but not many players?
Workspace.Player1.LocalScript:2: attempt to index field 'Character' (a nil value)
Here is my script.
for _, v in pairs(game.Players:GetPlayers()) do
if v.Character.Humanoid.Health == 0 then --The error showed me this line.
workspace.Players[v.Name]:Destroy()
end
end

3 comments
Make a code block for if the character exists. A Player can still be in a game without a Character, therefor, the player's character will be nil.
I'll look into it.
I got it! Thank you so much. I wish I can upvote you but I can't because I don't have enough reputation. ;-;