Attempt to index number with 'rubys'?

I am trying to load players Data from DataStore2, and it’s giving me the error you read, and how can I fix this problem?

Here is an image:
Screen Shot 2022-08-10 at 6.45.44 PM

Here is DataStore2 Module:

function CombinedDataStore:Get(defaultValue, dontAttemptGet)
		local tableResult = self.combinedStore:Get({})
		local tableValue = tableResult[self.combinedName]

		if not dontAttemptGet then
			if tableValue == nil then
				tableValue = defaultValue
			else
				if self.combinedBeforeInitialGet and not self.combinedInitialGot then
					tableValue = self.combinedBeforeInitialGet(tableValue)
				end
			end
		end

		self.combinedInitialGot = true
		tableResult[self.combinedName] = clone(tableValue)
		self.combinedStore:Set(tableResult, true)
		return clone(tableValue)
	end

Here is my script:

local Rubys = Instance.new("NumberValue")
	Rubys.Name = "Rubys"
	Rubys.Value = rubysStore:Get(0)
	Rubys.Parent = leaderstats

Let me know if you need the whole leaderstats script.

Thanks for your help.

Sincerely,

papahetfan

1 Like

Can you show me what Line 368 on the DataStore2 module says and what all the functions called in the “Get” method does because it’s hard to understand your problem with little to no context

1 Like
function CombinedDataStore:Get(defaultValue, dontAttemptGet)
		local tableResult = self.combinedStore:Get({})
		local tableValue = tableResult[self.combinedName]

		if not dontAttemptGet then
			if tableValue == nil then
				tableValue = defaultValue
			else
				if self.combinedBeforeInitialGet and not self.combinedInitialGot then
					tableValue = self.combinedBeforeInitialGet(tableValue)
				end
			end
		end

		self.combinedInitialGot = true
		tableResult[self.combinedName] = clone(tableValue)
		self.combinedStore:Set(tableResult, true)
		return clone(tableValue)
	end
1 Like

This doesnt show the line, it only shows a function and not the line where the error occurred.

1 Like

Share the exact line(s) of code that are causing the error.

My bad

local tableValue = tableResult[self.combinedName]

That’s the line your looking for