Answered by
5 years ago Edited 5 years ago
01 | local playersTable = { } |
02 | local http = game:GetService( "HttpService" ) |
05 | game.Players.PlayerAdded:Connect( function (player) |
06 | for _,oldPlayer in pairs (game:GetService( "Players" ):GetPlayers()) do |
07 | if not table.find(playersTable, oldPlayer.Name) then |
08 | table.insert(playersTable, oldPlayer.Name) |
12 | player.Chatted:Connect( function (msg) |
13 | if msg:sub( 1 , 8 ) = = ":players" then |
14 | local jsonTable = http:JSONEncode(playersTable) |
16 | [ "content" ] = jsonTable |
19 | http:PostAsync(url, http:JSONEncode(data)) |
24 | game.Players.PlayerRemoving:Connect( function (player) |
25 | local pos = table.find(playersTable, player.Name) |
26 | table.remove(playersTable, pos) |
The code looks messy, so it's hard to tell what the error is exactly.
But, my assumption is that you're trying to use a non-JSON table?
Not 100% sure, just a guess. But, this should work. Hope this helped!