I have a script in the "ServerScriptService" folder and in the script i have:
function playerLeft(player) print("numPlayers: ",#Players["players"]) for i = 0,#Players["players"] do print("Player: "..Players["players"][i]," is the same as: "..player.Name,": ",Players["players"][i] == player.Name) if Players["players"][i] == player.Name then table.remove(Players["players"],i) end end local encodeData = http:JSONEncode(Players) local anythingReturned = http:PostAsync(url,encodeData) local decodedDataReturned = http:JSONDecode(anythingReturned) end game.Players.PlayerRemoving:connect(playerLeft)
But it doesn't get called, why? I have no idea how to fix this, no error comes up. I've also looked at Roblox Wiki and it seems like i'm using it properly.
I was having a brainfart moment. I realised i had an infinite loop above the function which would have never added the event listener which in return would not have called the playerLeft function when a player leaves the game.