Attempt to index number with ' Name ' [Repost]

Provide an overview of:

  • What does the code do and what are you not satisfied with?

The code is supose to add Exp to but is say’s that attempt to index with ’ Name ', probrably i need remove a .Name in somewhere but i dont know where, the code basically add Exp to data Exp Player.

local DataOfPlayer = DataStore:WaitForChild("BlindFunction"):Invoke("GetData", Player)
DataStore:WaitForChild("BlindFunction"):Invoke("ChangeData", Player, "EtcMasteryExp", DataOfPlayer["EtcMasteryExp"] + (math.random(1, 10)))

Thanks.

It’s possible the code is erroring in both of the :Invoke()'s you’re calling

hey soo i dont know if is correct but the error is at the second line idk srry

Can you show the script that has the “Invoke” callback?

hey sorry for the delay here is it

script.Parent.DataStore.BlindFunction.OnInvoke = function(what, arg1, arg2, arg3)
	print("Get Invoked for "..what.." information.")
	if what == "ChangeData" then
		BlindFunction(arg1, arg2, arg3)
	elseif what == "GetData" then
		return dataFolder[arg1.Name]
	end
	
	return nil
end

Sorry for any confusion, I mean’t the ENTIRE script.

I think you need to use tonumber() to convert a string to numbers, as long at the string is just numbers, so it would be like this:

tonumber(DataOfPlayer["EtcMasteryExp"]) + (math.random(1, 10)