What is the issue? My ban script was working fine and now its not working for some reason
What solutions have you tried so far? I tried to look at devforum but i din’t found a solution.
Script:
local datastoreservice = game:GetService("DataStoreService")
local bandata = datastoreservice:GetDataStore("TimedBans")
game.Players.PlayerAdded:Connect(function(plr)
local data = bandata:GetAsync(plr.UserId)
if data[1] == plr.UserId then
if os.time() >= data[2] then
bandata:SetAsync(plr.UserId,{".",".","."})
else
local d = data[2] - os.time()
local s = d / 86400 -- Days
local f = math.round(s)
plr:Kick("\n You have been banned\n For: "..data[3].."\n Day/Days Left Until Unban: "..f.."")
end
end
end)
at line 15, (plr:Kick()) its giving me this error: “Attempt to concatenate nil with string”, How i could fix this?
then there is no data in data[3]
your saving must be a little wrong
What happens if you leave the “Reason” string empty when banning a player it will spit out nil i guess or just save nothing.
Either you save an empty string when nothing is entered or you just make the provided script check if there is data[3] and if not then just put an empty string right there
plr:Kick("\n You have been banned\n For: "..data[3] or "".."\n Day/Days Left Until Unban: "..f.."")