hi, I was working at my Ad Sistem, I save the Ads with DataStore and HttpService but the problem is, I made a part what if the Ad Duration time is bigger than 1 day, the ad will be deleted, but the problem is if it is at the Ad 5 or bigger, it will error this:
Probably why you shouldn’t upload error messages as images: the image isn’t loading. Please make sure to correct that so we can see the actual error information that’s occurring for your code.
I noticed also that you are using JSON encode/decode for DataStore (and even lacking use of GetService for HttpService). Don’t do this. DataStores already internally transform your information into a string value, so you’re double encoding and inflating the size of your DataStores.
coroutine.wrap(function()
while wait(15) do
local FullData,Data = {},game.HttpService:JSONDecode(AdStore.VideoSaving:GetAsync('VideoSavingKey4'))
if Data == nil then return end
spawn(function()
for i,Ad in ipairs(Data) do
warn(i)
local TimeStamp = Ad[1][3]
warn(TimeStamp)
if os.time() - tonumber(TimeStamp) >= 86400 then
else
FullData[#FullData + 1] = Data
end
end
spawn(function()
Data = game.HttpService:JSONEncode(FullData)
AdStore.VideoSaving:SetAsync('VideoSavingKey4',Data)
end)
end)
end
end)()