It looks like you have other scripts responsible for the ban. Show them all.
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.
Ok, do you have other accounts that where already created?
^ They were children of the gui.
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
Yeah, user get’s entered*. How do I remove it?
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)
local me = DataStoreService:GetDataStore("ma")
local success, me = pcall(function()
return ma:RemoveAsync("Player_1234")
end
game:GetService("DataStoreService"):GetDataStore("TimedBans"):RemoveAsync(UrUserId)
Put this in command bar
Do I just paste it in and swap the user with mine?
Thank you friend, solved. I appreciate it everyone who helped.
By the way, make sure to check if the player who fired the RemoteEvent has enough authority to ban people. Otherwise, exploiters.
Oh thanks for reminding me, I completely forget some people devote their lives to hacking in a lego game and will find vulnerabilities.
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.
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.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.