Hello, I am making a ban system with a reason field, when the ban button is fired, it will save the user to the data store with the 3rd argument providing the reason…
Problem, is, it keeps on saying “Unable to cast array”… I tried using the array’s from 1 - 3. Nothing has worked.
Error:
SetAsync line:
game:GetService("DataStoreService"):GetDataStore("LyfeBan_1"):SetAsync(t.UserId, true, "testing")
Get Async script:
local DSS = game:GetService("DataStoreService")
local Key = DSS:GetDataStore("LyfeBan_1")
local Bans = {}
game.Players.PlayerAdded:Connect(function(plr)
for i,v in pairs(Bans) do
if plr.UserId == i then
plr:Kick("\n\n == LYFE ADMIN SYSTEM == \n\n You have been terminated from Lyfe or possibly all Disruption Studio games. \n\n Reason: " .. tostring(v) .. " \n\n If you think this was a mistake, please contact a HR or higher to unban you! \n")
end
end
local banned
local success, result = pcall(function()
banned = Key:GetAsync(plr.UserId, {})
end)
if banned == true then
plr:Kick("\n\n == LYFE ADMIN SYSTEM == \n\n You have been terminated from Lyfe or possibly all Disruption Studio games. \n\n Reason: " .. tostring(banned[3]) .. " \n\n If you think this was a mistake, please contact a HR or higher to unban you! \n")
end
end)