Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

I made this temp ban GUI, but it wont work! Can someone help me?

Asked by 7 days ago

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?

0
You can only store letters in DataStores Pupppy44 458 — 7d

Answer this question