Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Datastore error: a nil value? [SOLVED]

local DataStore = game:GetService("DataStoreService"):GetDataStore("AdvertSaver")
while wait(2) do
	local hoursofadvert = 24
	local currenttime = os.time()
	local hourssincelastrun = currenttime - DataStore:GetAsync("AdvertShirt-Time")
	if DataStore:GetAsync("AdvertShirt-Id") >= 1 then
		if (hourssincelastrun/3600) >= hoursofadvert then
			DataStore:SetAsync("AdvertShirt-Id",0)
			DataStore:SetAsync("AdvertShirt-Time",0)
		end
	else
		DataStore:SetAsync("AdvertShirt-Id",0)
		DataStore:SetAsync("AdvertShirt-Time",0)
		print("Shirt Id is Invalid")
	end
end

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.