I’m working on a ban panel for my game and for some reason I keep getting this error everytime I fire the event saying: 104: Cannot store Array in data store. Data stores can only accept valid UTF-8 characters. Here’s the code:
game.ReplicatedStorage.BanOrUnbanPlayer.OnServerEvent:Connect(function(player, playerToBan, Reason, Ban)
if Ban == "Ban" then
for i,v in pairs(moderators) do
if player.UserId == v then
if game.Players:FindFirstChild(playerToBan) then
if game.Players[playerToBan].UserId ~= player.UserId then
print(playerToBan.." has been successfully banned!")
game.Players[playerToBan]:Kick("You've been banned from The DS Solar Ship. \n Reason: "..Reason)
ModerationDataStore:SetAsync(game.Players[playerToBan].UserId, {true, Reason})
else print("This player is an admin")
end
else
local players = game:GetService("Players")
local Id = players:GetUserIdFromNameAsync(playerToBan)
if Id ~= player.UserId then
ModerationDataStore:SetAsync(Id, {true, Reason}) -- The line the error is marking
print(playerToBan.." has been banned!")
end
end
end
end
elseif Ban == "Unban" then
local players = game:GetService("Players")
local Id = players:GetUserIdFromNameAsync(playerToBan)
ModerationDataStore:RemoveAsync(Id)
print(playerToBan.." has been unbanned!")
end
end)