Cant Access offline Players Datastore

ServerScriptService.Admin:48: attempt to call missing method ‘WaitForChild’ of string

Replace plrmessage[2] with plr

that would distrupt all other commands, i tried it anyways and it still says im banned

Was the function called? Or not?

yes it was, character limitttttttttttttt

I recommend making a seperate datastore for ban checks.

i can do that but i still cant access any datastore

One question, is your datastore Datastore2?

what is that, I dont know. character limit

i created a seperate datastore and parented the bool value directly to the player

Okay, so, in the commands script, access the BannedDatastore and do BannedDatastore:SetAsync(player.UserId, false) for unbanning offline players, BannedDatastore:SetAsync(player.UserId, true) for banning offline players.

Argument 1 missing or nil - Server - Admin:49

	print("unban command")
	
	local playerId = game.Players:GetUserIdFromNameAsync(player)

	local playerData
	local success, error = pcall(function()
		playerData = playerDataStore:GetAsync(tostring(playerId))
	end)

	if success then
		-- Modify the BannedCheck value to false
		print(player)
		playerDataStore:SetAsync(player.UserId, false) -- this is line 49
		-- Save the modified data back to the data store
		local saveSuccess, saveError = pcall(function()
			playerDataStore:SetAsync(tostring(playerId), playerData)
		end)

		if saveSuccess then
			print("Player data saved successfully.")
		else
			warn("Failed to save the player's data: " .. saveError)
		end
	else
		warn("Player data not found or BannedCheck value is nil.")
	end

i Also got this: DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 1543121341 (x3)

What line, and are you using the ban datastore to setaync?

This is the new ban DataStore

-- This is where data is stored if you mess this up by editing it when you dont know what you're doing the players data goes kapoosh, so please dont
-- scripted by talis783 aka repliz

local DataStore = game:GetService("DataStoreService")
local PlrDataStore = DataStore:GetDataStore("PlayerData")

local admins = {"talis783"}

game.Players.PlayerAdded:Connect(function(Player)
	
	
	local BannedCheck = Instance.new("BoolValue")
	BannedCheck.Parent = Player
	BannedCheck.Name = "BannedCheck"
	BannedCheck.Value = false
	
	
	local PlayerData

	local succes, ErrorMsg = pcall(function()
		local PlayerId = Player.UserId
		PlayerData = PlrDataStore:GetAsync(PlayerId)
	end)
	
	
	if succes then
		if PlayerData then
			BannedCheck.Value = PlayerData[1]
			print(BannedCheck.Value)
			if BannedCheck.Value == true then
				--if not table.find(admins, Player.Name) then
				task.wait(10)
					Player:Kick("You are banned")
				--end
				
			end
		end

	else
		warn(ErrorMsg)
	end
end)


local function saveData(Player)
	local ToolsSave = Player.ToolsSave
	local PlayerData = {Player.BannedCheck.Value}
	
	
	local Success, ErrorMsg = pcall(function()
		PlrDataStore:SetAsync(Player.UserId, PlayerData)
	end)

	if not Success then
		warn(ErrorMsg)
	end

	if Success then
	end
end

game.Players.PlayerRemoving:Connect(function(Player)
	saveData(Player)
end)

game:BindToClose(function()
	for _, Player in pairs(game.Players:GetPlayers()) do
		saveData(Player)
	end
end)

First of all, you’re using the same data store that (i think) overrides the player’s data.
Make a new datastore name like BannedDatastore or PlayerBanChecks.

it went through all the print commands that say sucess but i still got the DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 1543121341 error and im still banned

One sec, let me check my own banning datastore.

local DSS = game:GetService("DataStoreService")
local BanDataStore = DSS:GetDataStore("BanData1")

local modEvents = game.ReplicatedStorage.remoteEvents.ModerationEvents

local unbannable = {
	"talis783",
}

game.Players.PlayerAdded:Connect(function(player)

	local data = BanDataStore:GetAsync(player.UserId)
	if data then
		
		if data.Banned == true then

			player:Kick("You've been banned!")

		end
		
	end

end)

modEvents.Ban.OnServerEvent:Connect(function(plr, bannedPlayer)
	
	for i, accessName in pairs(unbannable) do

		local findUser = game.Players:GetUserIdFromNameAsync(accessName)
		print(findUser)

		if findUser and plr.UserId == findUser then

			local selectedUserId = game.Players:GetUserIdFromNameAsync(bannedPlayer)

			if selectedUserId then
				
				BanDataStore:SetAsync(selectedUserId, {["Banned"] = true})
				game.Players:FindFirstChild(bannedPlayer):Kick("You've been banned!")

			end
			break

		end

	end

end)

modEvents.UnBan.OnServerEvent:Connect(function(plr, bannedPlayer)
	
	local selectedUserId = game.Players:GetUserIdFromNameAsync(bannedPlayer)
	
	if selectedUserId then
		
		BanDataStore:SetAsync(selectedUserId, {["Banned"] = false})
		
	end

end)

This is what your ban datastore should look like.

it relies on remote events to ban and unban, thats not what i have setup