Technically player object exists and it's connected flag is correct but player.character is most likely invalid. Not sure what check would be needed for that - might be enough to check if player.character is valid in line 137. I have no means to test this tho so it's a bit of a guess.
You would need to change line 137 to this:
Code: Select all
if player.connected and player.character.valid then