How can I check to see if the player is terminated using a userId?
Using roblox’s web API, you can send a GET request to https://users.roblox.com/v1/users/{userId} where {userId} is where the user’s userId goes. (See endpoint documentation)
The API endpoint provides a JSON string that needs to be JSON decoded and it provides an entry in the table with an index of IsBanned
and a boolean as a value (if true, the user is banned, false if otherwise)
We can’t send requests to roblox domain from studio nor the player client, so you can use http://rprxy.xyz or your own dedicated proxy server:
local ID = 1
local http = game:GetService("HttpService")
local url = ("https://users.rprxy.xyz/v1/users/%d"):format(ID)
local result = http:JSONDecode(http:GetAsync(url))
print(result.isBanned)
it works for the most part but eventually returns a 404 error, why is that?
You can get error 404 if you used the wrong url or the ID you used doesn’t exist or it does not belong to a player. You can try implementing a retry procedure if the request failed (due to 404 or 429 – sending too many requests to the endpoint) to resend the request a few seconds later:
function send(ID, tries)
tries = tries or 0
local success, response = pcall(function()
local http = game:GetService("HttpService")
local url = ("https://users.rprxy.xyz/v1/users/%d"):format(ID)
local result = http:JSONDecode(http:GetAsync(url))
return result.isBanned
end)
if not success and tries < 5 then
tries += 1
task.wait(3)
return send(ID, tries)
elseif success then
return response
elseif not success and tries >= 5 then
return "Couldn't get termination status"
end
end
local isBanned = send(1)