How Would I Implement a Ban Reason?

Already explained in the title; how should I go about implementing a ban reason? I already have the banning part done, here’s my code so far:

function module:BanUser(plrId)
	local plr = game.Players:GetPlayerByUserId(plrId)

	if plr then
		DataStore:SetAsync(plrId.."-ban", true)
		plr:Kick("\n n You have been permanently banned by an administrator.")
		print("Player is in-game. They will be kicked from the server and globally banned.")
	else
		warn("Player is not in-game ["..plrId.."]. They will still be banned.")
		DataStore:SetAsync(plrId.."-ban", true)
	end

end

I’m looking for something like this:

image

When a plr joins check if they are in the ban list then do plr:Kick(REASON). Also try setting the key to a table containing the reason and other necessities.

You could set the key to the reason instead of just true. Then to unban the player remove the key with :RemoveAsync(). Then when they join you check if their key is not nil, if it’s not then kick them for the value of the key.

2 Likes

Seems to work, thanks!

This text will be blurred