function DataStore.Debug(P,...)if P.debug then print(...)end end function DataStore._GetRaw(P)if not P.getQueue then P.getQueue=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")end if P.getting then P:Debug("\065 \095\071\101\116\082\097\119 \105\115 \097\108\114\101\097\100\121 \105\110 \109\111\116\105\111\110\044 \106\117\115\116 \119\097\105\116 \117\110\116\105\108 \105\116\'\115 \100\111\110\101")P.getQueue.Event:wait()P:Debug("\065\097\097\110\100 \119\101\'\114\101 \098\097\099\107")return end P.getting=true local T,N=P.savingMethod:Get()P.getting=false if not T then error(tostring(N))end P.value=N P:Debug("\118\097\108\117\101 \114\101\099\101\105\118\101\100")P.getQueue:Fire()P.haveValue=true end function DataStore._Update(T,P)if not P then for P,N in pairs(T.callbacks)do N(T.value,T)end end T.haveValue=true T.valueUpdated=true end
--Internal functions
function DataStore:Debug(...)
	if self.debug then
		print(...)
	end
end

function DataStore:_GetRaw()
	if not self.getQueue then
		self.getQueue = Instance.new("BindableEvent")
	end

	if self.getting then
		self:Debug("A _GetRaw is already in motion, just wait until it's done")
		self.getQueue.Event:wait()
		self:Debug("Aaand we're back")
		return
	end

	self.getting = true

	local success, value = self.savingMethod:Get()

	self.getting = false
	if not success then
		error(tostring(value))
	end

	self.value = value

	self:Debug("value received")
	self.getQueue:Fire()

	self.haveValue = true
end

function DataStore:_Update(dontCallOnUpdate)
	if not dontCallOnUpdate then
		for _, callback in pairs(self.callbacks) do
			callback(self.value, self)
		end
	end

	self.haveValue = true
	self.valueUpdated = true
end
