I need help figuring why my ban script respond with "Unkown response"

Hello,

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?

Summary
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:

elseif result["banned"] == "True" then

Hopefully, this fixes your problem :slight_smile:

1 Like

Website returns the data as expected.

I don’t like roblox manual side banning.
I want to be able to remote ban, that’s why i got this.

image

Lol, didn’t think of that as an issue.
It was all just a small capital issue.

Thanks.

1 Like

A small note.
I removed the last part of the url.
Forgot to say that.

I don’t want to expose the location on my domain, where i check for bans.
In case someone tries to get it down.

But so far, i’ve not had 1 issue using my website as a place to store bans.
But using DataStores on the other hand.

Don’t get me started.

  1. No backup.
  2. If roblox loses data it’s go go for it.
  3. There has been too many examples of corrupt DataStores over time, that i no longer trusts it.