I have a simple script that checks if a player is afk or not, however when I run it I keep getting this warning: "attempt to index field '?' (a nil value)"
Here is the code where it is having problems and the error comes up on line four. The script is currently located in game.ServerScriptService
players = game.Players:GetChildren()
for i = 1, #players do
if players[i]:FindFirstChild("IsPlaying") then
if players[i].IsPlaying.Value == false then
table.remove(players, i)
end
end
end
I'm pretty new to this so any help is appreciated!

1 comment
It works now! Thank you so much! :D