PlayerRemoving not being called when player leaves, why?[SOLVED]
Asked by
8 years ago Edited 8 years ago
I have a script in the "ServerScriptService" folder and in the script i have:
01 | function playerLeft(player) |
02 | print ( "numPlayers: " ,#Players [ "players" ] ) |
03 | for i = 0 ,#Players [ "players" ] do |
04 | print ( "Player: " ..Players [ "players" ] [ i ] , " is the same as: " ..player.Name, ": " ,Players [ "players" ] [ i ] = = player.Name) |
05 | if Players [ "players" ] [ i ] = = player.Name then |
06 | table.remove(Players [ "players" ] ,i) |
09 | local encodeData = http:JSONEncode(Players) |
10 | local anythingReturned = http:PostAsync(url,encodeData) |
11 | local decodedDataReturned = http:JSONDecode(anythingReturned) |
13 | 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.