I’ve used this system for several years, but now lately, it’s stopped responding by kicking the user.
Now it just responds with “Unkown response”
As you can see below, that’s how it’s set up.
Does anyone know why it does not kick anyone anymore?
serveruri = 'https://newstargeted.com/'
http = game:GetService('HttpService')
function RemoveFromGame(Player)
Player:Kick("You have been kicked for exploiting")
end
game.Players.PlayerAdded:connect(function(Player)
local result = http:GetAsync(serveruri..Player.userId)
print(result)
local result = http:JSONDecode(result)
if result["error"] then
print(result["error"])
elseif result["banned"] == "true" then
RemoveFromGame(Player)
print('Player "'..Player.Name..'" is banned and therefore removed from the game.')
elseif result["banned"] == "false" then
print('Player "'..Player.Name..'" is not banned.')
else
print('Unkown response')
end
end)
while wait(10) do
for _,Player in pairs (game.Players:GetPlayers()) do
local result = http:GetAsync(serveruri..Player.userId)
print(result)
local result = http:JSONDecode(result)
if result["error"] then
print(result["error"])
elseif result["banned"] == "true" then
RemoveFromGame(Player)
print('Player "'..Player.Name..'" is banned and therefore removed from the game.')
elseif result["banned"] == "false" then
print('Player "'..Player.Name..'" is not banned.')
else
print('Unkown response')
end
end
end
Just throwing this out there, and I haven’t really thoroughly looked through your code but it’s probably because your website isn’t returning any result. I did a quick test by hitting it in my browser and checked for a response in the dev console and I didn’t see anything. A more reliable method would be to use Roblox’s built in data stores. If you need to ban players across games I would suggest creating your own server specifically for this purpose. This whole website thing seems really unreliable.
If we take a look at one of the lines of code for example where you compare the banned value from the JSON result.
elseif result["banned"] == "true" then
You can see that you are comparing the result with true whereas it should be capitalized as that is how it is returned from your web server. So all you have to do is replace true and false with the capitalized versions of them in your if statements. So this line should look like this: