Unbanning Player Error

Hi, I was coding a admin script and i ban myself it did worked success but i tried unbanning myself and i dont know how to do it. Here the script:

ReplicatedStorage.Remotes.Unban.OnServerEvent:Connect(function(plr)
	local s,e = pcall(function()
		BannedPlayers:RemoveAsync(plr.UserId)
	end)
	if not s then
		TestService:Error(e)
	else
		print("Unbanned Success")
	end
end)

if you how to fix it, tell in the comments!

2 Likes

Can you show us the script, where you bann the players?

1 Like

Sure:

ReplicatedStorage.Remotes.Ban.OnServerEvent:Connect(function(plr, reason, duration)

	local s, e  = pcall(function()
		BannedPlayers:SetAsync(plr.UserId,{['Name'] = plr.Name,['UserId'] = plr.UserId, ['Reason'] = reason})
	end)
	if not s then 	
		TestService:Error(e) 
	else
		plr:Kick("You're Been Banned \n Reason: \n"..reason.."\n Duration: "..duration)
	end
end)

Run the RemoveAsync() line in studio’s command bar.

If you’re using DataStorage,maybe you could try to rename the storage where the bans are kept to something else? Maybe that will work.

Im using datastoreservice to store the player ban so it uses Datamemory

is it possible store the data in the server not the player pc? they can easily be unbanned