Ban Command Banned Everyone

IDEA look at this image. Could the player be making it where the moderator gets banned??

image

Here is a handy guide. They work like anonymous functions.


local success, value = pcall(function(number)

return number + 5


end, 20)

print("pcall returns", success, value)

In this example, value is 25.

So practically we may do something like this:

local Success, ErrorMessage = pcall(function(banUserId)
 BanDataStore:SetAsync(banUserId, true)

 end, Name.UserId)

I also noticed that for some reason you are trying to add ā€œPlayerā€ to the ban datastore? I figured that was a bug?

Nope, I fixed it. I just had to make the Player into Name.UserID in the :setasync

I guess that was the real bug. At any rate, be careful of scope leaking. I have no idea why it was possibly also banning every player, which sounds like a major issue.

Whatā€™s scope leaking? Adding characters

all i can really suggest is to use hdadmin. it is a bit buggy when it comes to bans (you cant re-ban someone after unbanning them unless you update the game and restart the servers), but itd certainly solve your problem.

Hmmm, Iā€™m not fully sure if thatā€™s true. Iā€™ll test it out Iā€™ll make a unban command. Then Iā€™ll ban him then unban him and then ban him again. Let me see if it would work.

Time to use my brain to see how to make a unban commnad.

I think you mean when I do the unban command Iā€™m going to set it to RemoveAsync where Iā€™m actually going to set the value to false.

This topic is about a ban command, not a unban command. If you need help with your unban command, open a different post.

(sorry for revive didnā€™t realise this was 16 days old)

I think its fine because it is still related to that piece of code. The only time it is not acceptable is asking for how to make a lightsaber code on a question about doors.

1 Like