The issue with the code is that it says
**ServerScriptService.Ban:36: attempt to perform arithmetic (mul) on nil and number **
Here is the line of code that is 36:
banService:SetAsync(plr.UserId, math.floor(tonumber(DateTime.now()) * 0.001))
For some reason, DateTime.now() isnt counted as a number. I want to use it in my ban system but its not working.
Here is my code:
game.Players.PlayerAdded:Connect(function(plr)
for i,v in pairs(bannedPeople) do
if v.UserId == plr.UserId then
local check = banService:GetAsync(plr.UserId)
if check == nil then
banService:SetAsync(plr.UserId, math.floor(tonumber(DateTime.now()) * 0.001))
plr:Kick("You have been banned for " .. v.Reason .. "! You will be unbanned in " .. v.Days .. " day(s)")
else
local tim = tonumber(DateTime.now()) * 0.001
if tim > v.Days * 86400 + check then
banService:SetAsync(plr.UserId, nil)
else
plr:Kick("You have been banned for " .. v.Reason .. "! You will be unbanned in " .. v.Days * 86400 + check - tim)
end
end
end
end
end)