local allplayers = game.Players:GetPlayers()
for i = 1, #allplayers do
local oneplayer = allplayers[i]
if oneplayer ~= nil and oneplayer:FindFirstChild("leaderstats") ~= nil then
rewardplr(oneplayer)
end
end
Apparently this failed, softlocking the game session. I’m learning scripting by myself with trial and error so I can make mistakes without noticing. Can anyone enlighten me? Also how could I prevent this failing?
No, I don’t have access to output since this was a bug report from a few hours ago. It’s probably a super rare thing too.
The only thing I can think of is someone leaving right as the script is firing the function but then “oneplayer ~= nil” is there for that…?
Actually, yeah, that seems very possible and the function can check for that. Alright, I’ll try this and hope it doesn’t happen ever again. This is a very rare bug report so I’ll leave this up just in case someone can pin-point the mistake. Thanks
~= is fine I guess even tho not needed, but if it was failing it probably because of a spelling error on leader stats, could have made it a capital L not lower case