Showing who banned the player

HOLY COW! I been scripting for so long and following ton’s of videos. I made so many datastores, but my question is how can I show the admin who banned the person in the ban reason?

			if Banned == true then
					Player:Kick("You have been banned by a Blossom County moderator. If this was a mistake, please appeal in our Discord server linked below our game. Moderator:"..--Tried to show the moderator who did it, right after this note--Player:GetRankInGroup(15423675) >= 245)

When the person is banned, you need to add an admin param into the database you save the bans on so it can save it.
Also, I need more code since it’s not rlly enough.

DataStoreService = game:GetService("DataStoreService")
DataStore = DataStoreService:GetDataStore("ASLDJAISD")

			elseif SplitCommand[1] == ":ban" or SplitCommand[1] == ":Ban" then
				local TargetedPlayer = SplitCommand[2]
				local Name = game.Players:FindFirstChild(TargetedPlayer)
				BanDataStore:SetAsync(______, true)

				--Ban Player Datastore
				local Banned
				local Success, Error pcall(function()
					Banned = BanDataStore:GetAsync(________)
				end)
				if Banned == true then
					Player:Kick("You have been banned by a Blossom County moderator. If this was a mistake, please appeal in our Discord server linked below our game. Moderator:"..Player:GetRankInGroup(15423675) >= 245)
					--Ban Player Datastore

does it use values or datastores?

Where should I add the parameter?

Yes… right above in that script on the 1st line

You should add a setasync for the admin that banned the person. Define whoever ran that command (player object) and add it sort of like this BanDataStore:SetAsync(“admin”, admin.Name) replace admin.Name with the player object you have defined

I can elaborate if it makes no sense

Something like this?

local Banned
				local Success, Error pcall(function()
					Banned = BanDataStore:GetAsync(Player.UserId, "Admin")
				end)

it uses values? because u can edit script to add another value instead that banned user value then edit that ban message to
You have been banned by a Blossom County moderator. If this was a mistake, please appeal in our Discord server linked below our game. Moderator: "..plrbanvalue:WaitForChild("moderator").Value

I didn’t make it a whitelist like that, I use’d groups

game.Players.PlayerAdded:Connect(function(Player)
	if Player:GetRankInGroup(15423675) >= 245 then
		Player.Chatted:Connect(function(Command)

above the command script u can do
local moderator = Instance.new(“IntValue”,bannedplayer)
moderator.Name = “MODERATORWHODID”
moderator.Value = Player.Name

like this:

		 BanDataStore:SetAsync("admin", Player.UserId)
--then when they are kicked: 
Player:Kick("You have been banned by a Blossom County moderator. If this was a mistake, please appeal in our Discord server linked below our game. Moderator:"..BanDataStore:GetAsync("admin"))


-- Roblox Creator Docs is your friend!

Like this?

			elseif SplitCommand[1] == ":ban" or SplitCommand[1] == ":Ban" then
				local TargetedPlayer = SplitCommand[2]
				local Name = game.Players:FindFirstChild(TargetedPlayer)
				BanDataStore:SetAsync("Admin", Name.UserId, true)

if Banned == true then
					Player:Kick("You have been banned by a Blossom County moderator. If this was a mistake, please appeal in our Discord server linked below our game. Moderator:"..BanDataStore:GetAsync("admin"))

Nevermind what I said earlier, it’s great test it out!

Has my solution worked? Give a solution mark to the reply with the answer!
If it doesn’t please reply and give me the error!

Nope, I’m just trying to show the moderator who banned the person

what was the error then? my solution in the head seemed like it would work

Not sure, I might make a new dev forum post since I thought of some other questions related to this topic.

Store that data, either their name or UserId (so, via certain functions, you can get their updated name at the time the player joins). I assume you are using the <Player>.Chatted signal. This means you already have access to the Player DataModel.

As part of the data you are storing (such as the player who is banned, the reason, etc, you can also store data about the individual who did ban them.