How to unban yourself...? Yeah I know it's stupid

It looks like you have other scripts responsible for the ban. Show them all.

3 Likes

I tried making an alt, but I’m bugged right now and when I try create an account it just says “something went wrong” after signing up.

1 Like

Ok, do you have other accounts that where already created?

2 Likes

1


Here’s a ban and unban handler.

2

1 Like

^ They were children of the gui.
image

2 Likes

When you ban someone, does it store the user name in a Datastore if so, you can probaby access it and remove your name out of it

3 Likes

Yeah, user get’s entered*. How do I remove it?

2 Likes

Please send them in script format:

2 Likes

Sorry here:

Admins script:

local admins = {173412116}

game.Players.PlayerAdded:Connect(function(plr) 
	for i,v in pairs(admins) do 
		if v == plr.UserId then 
			local cl = script.BanGUI:Clone() 
			cl.Parent = plr.PlayerGui 
		end
	end
end)

ban handler:


local datastoreservice = game:GetService("DataStoreService") 
local bandata = datastoreservice:GetDataStore("TimedBans")

script.Parent.Parent.Ban.OnServerEvent:Connect(function(plr,plrtoban,reason,days,status) 
	local uid = game.Players:GetUserIdFromNameAsync(plrtoban) 
	local ostime = os.time() -- Time
	local days = tonumber(days) 
	local d = days * 86400 
	local length = d + ostime 
	local table2 = {uid,length,reason} 
	bandata:SetAsync(uid,table2) 
	status.Text = "Banned: "..plrtoban..""
	if game.Players:FindFirstChild(plrtoban) == nil then
		print("Not in server")
	else
		game.Players:FindFirstChild(plrtoban):Kick("You have been banned\n For: "..reason.."")
end)


Unban Handler:


local datastoreservice = game:GetService("DataStoreService") 
local bandata = datastoreservice:GetDataStore("TimedBans")


script.Parent.Parent.Unban.OnServerEvent:Connect(function(plr,plrtounban,status)
	local uid = game.Players:GetUserIdFromNameAsync(plrtounban)
	bandata:SetAsync(uid,{".",".","."})
	status.Text = "Unbanned: "..plrtounban.."" 
end)


2 Likes
local me = DataStoreService:GetDataStore("ma")
 
local success, me = pcall(function()
	return ma:RemoveAsync("Player_1234")
end
2 Likes
game:GetService("DataStoreService"):GetDataStore("TimedBans"):RemoveAsync(UrUserId)


Put this in command bar


3 Likes

Do I just paste it in and swap the user with mine?

1 Like

Thank you friend, solved. I appreciate it everyone who helped.

2 Likes

By the way, make sure to check if the player who fired the RemoteEvent has enough authority to ban people. Otherwise, exploiters.

3 Likes

Oh thanks for reminding me, I completely forget some people devote their lives to hacking in a lego game and will find vulnerabilities.

2 Likes

I also recommend to use table.find. The function also goes through all indexes of the table, however the function I mentioned is written in C and is more optimized.

Also, if you want to keep the for loop you have, you can use the break statement after you cloned and reparented the ban UI. This will cause the loop to stop. You do not need to cycle through all the admins’ IDs if you found out the player was the 2nd admin in the list!

Finally, you can use the game:GetService("RunService"):IsStudio(). This could help you in developing your admin panel, without having to issue real punishments, as shown here:

if RunService:IsStudio() then
    print("Banned " .. target.UserId ) --Assuming target is of type Player

else
    --Issue a real ban
end

This would make it so that you don’t ban yourself (or anyone else) for testing.

Either way, I wish you good luck.

1 Like

Thanks man, yeah getting yourself banned is kind of embarrassing but hey, we all start somewhere with coding I guess.

You may consider to add a sort-of whitelist (an admin banning another admin should not be possible).

I honestly could have made the mistake. We all did something similar at some point, that’s normal!

Yeah that’s probably a good idea, I should think more about exploiters and admin abusers, I’m wayy too trusting of people sometimes lol, anyways thanks for the help.

1 Like

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