Here's the server-sided script:

local DataStoreService = game:GetService("DataStoreService")
local TempBanDataStore = DataStoreService:GetDataStore("TempBanDataStore", 2)

game.ReplicatedStorage.ModEvents.BanPlayer.OnServerEvent:Connect(function(player, Username, Reason, SelectedDays, DayValue)
	local Success, Result = pcall(function()
		return TempBanDataStore:GetAsync(tostring(player.UserId), "TempBan")
	end)
	
	if Success then
		if Result then
			if Result.BanStartTime + Result.BanTime > os.time() then 
				print("Player's temp ban is lifted")
			else
				game.Players:FindFirstChild(Username):Kick("You have been banned for "..SelectedDays.." day(s) for: \n"..Reason.."\n Your were banned by: "..player.Name..".")
			end
		end
	end
	
	
	TempBanDataStore:SetAsync(game.Players:GetUserIdFromNameAsync(Username),{BanStartTime = os.time(), BanTime = SelectedDays})
end)

In the output, it says "104: Cannot store Dictionary in data store. Data stores can only accept valid UTF-8 characters." Can someone help me?

1 comment

0

You can only store letters in DataStores