Hello, recently I’m making a Ban admin panel with custom time bans, but I cannot figure this error out. it didn’t occur until recently so I’m not too sure. Here is a little snippet on the code:
local BanStore = DDS:GetDataStore("BanStore")
local banWait = 24
Players.PlayerAdded:Connect(function(plr)
local banData
pcall(function()
banData = BanStore:GetAsync(plr.UserId)
end)
if banData then
local Seconds = os.time() - banData
local mins = Seconds/60
local hrs = mins/60
if hrs >= 24 then
BanStore:RemoveAsync(plr.UserId)
BanStore:SetAsync(plr.UserId, os.time())
end
else
plr:Kick("You have been banned by an Administrator! (1 Day Ban)")
BanStore:SetAsync(plr.UserId, os.time())
end
end)
Then this might be because the banData variable turned into a string value. Luckily you can convert it into an int value (a.k.a number value) by simply typing this inside of a banData if statement just to be clear im not sure if this will function properly
if banData then
tonumber(banData)
local Seconds = os.time() - banData
--Rest of the script here
end