UnbanAsync() does not work

So earlier I was trying to make a video on how to use the ban API (BanAsync() and UnbanAsync()), and when i banned my alt and told it to include banning ‘alt accounts’, i ended up getting both my main and alt banned permanently. I tried several things like deleting the script, trying UnbanAsync(), and both failed. I am not sure what to do.

Edit: I have run the script in both a studio testing session, and also a roblox client (play) session.

Expected behavior

If UnbanAsync() is used, the userIDs should be unbanned, and not stay banned/perm-banned.

I thought there was a similar topic being created reporting this:

Maybe your Script couldn’t work in time before the BanAPI detects you and removes you from the game? You can try getting another alt to join the game with the UnbanAsync, as some people said that the alt-detection may sometimes fail

There are some rather hacks solutions in the topic attached. While engineers are still creating a page on the Creator Hub to manage the BanAPI for games, people would have to rely on the OpenCloud API to unban themselves for now

1 Like

Can you show me your UnbanAsync script? I’m pretty sure this works… it might just appear to be bugged because of poor code.

Also, this bug is in the wrong category. It should be in engine bugs.

1 Like

I believe it depends on ApplyToUniverse

1 Like

The game has to be run normally like played public for unbanAsync to take effect I’m pretty sure. It would be nice for it to just be able to run it without being ran like such though.

1 Like

Can you share the code you are using to call BanAsync and UnbanAsync?

Please note that deleting the script would not undo any ban calls that have already succeeded.

1 Like

image
image

1 Like

Are you by-chance running this in Studio? Calls made to the API while in Studio are documented to not work as the API only works in a live experience.

1 Like

I tried that code in my test place and it succeeded. Can you comment the place ID from which you ran this code so that I can look into our logs to try to figure out what happened?

In the meantime, here are some other things you can try to debug your issue:

  1. As mentioned by some of the other creators in this thread, make sure you are running this code on a live production game server rather than in a test environment such as in Studio.
  2. Put the functions calls within a pcall as the code sample in the documentation suggests so that you are able to catch any errors and print them out. Perhaps there are networking issues at play.
  3. Experiment with the User Restrictions Open Cloud API.
2 Likes

My bad, this wasn’t the one I used. This one here was the one I used

1 Like

Here’s the place ID 18308217753

I have tried using the studio side, but just “skips” past the ban, but when played live in the roblox client, is when it appears.

1 Like

Thanks for sharing the place ID; we’ll take a look.

When you’re running this script, make sure it is run on the server and not on the client. I put the script under ServerScriptService.

2 Likes

Yea, that’s where I put the script.

1 Like

The unban is not taking effect because you created a place level ban, but you are creating a universe level unban. The universe level unban does not override the place level ban you created, so the user is still effectively banned. For the unban to take effect, set ApplyToUniverse to false in the unban call.

I will update the documentation to reflect this soon. Thank you for bringing this to our attention.

2 Likes

Ohhh, I see. Thanks for the help :+1:

3 Likes

Exactly what I mentioned here

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.