Attempt to index number with ' Name ' [Repost]

ok so here is

local dataStore = game:GetService("DataStoreService"):GetDataStore("DataStore")
local remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteServer"):WaitForChild("Data"):WaitForChild("DataRemote")
local dataFolder = {}

local defaultData = {
	
	["EtcMastery"] = 1,
	["EtcMasteryExp"] = 0,
	["EtcMasteryExpNeeded"] = 10
	
}

function checkMastery(player)
	if dataFolder[player.Name]["EtcMasteryExp"] >= dataFolder[player.Name]["EtcMasteryExpNeeded"] then
		dataFolder[player.Name]["EtcMasteryExp"] = 0
		dataFolder[player.Name]["EtcMasteryExpNeeded"] = dataFolder[player.Name]["EtcMasteryExp"] + math.random(150, 350)
		dataFolder[player.Name]["EtcMastery"] = dataFolder[player.Name]["EtcMastery"] + 1
		remote:FireClient(player, "GiveData", dataFolder[player.Name])
	end
end
DataOfPlayer = DataStore:WaitForChild("BlindFunction"):Invoke("GetData")
DataStore:WaitForChild("BlindFunction"):Invoke("ChangeData", "EtcMasteryExp", DataOfPlayer["EtcMasteryExp"] + (math.random(1, 10)))
script.Parent.DataStore.BlindFunction.OnInvoke = function(arg1, what, 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

Check if this works. It implements my previous reply.

I do not think this will work. I understand that the first parameter is automatically set to the player, but it only happens on RemoteFunctions/Events and not BindableFunctions. I tested this earlier.

This is a blind function, not necessarily a bindable function. This means he could be using RemoteFunctions.

If he was using RemoteFunctions, it would be “OnServerInvoke” or “OnClientInvoke”. In this case, it is “OnInvoke” which indicates that it is a bindable function. I am sorry if I am incorrect.

Is it because in this if statement you are calling value.Name instead of using the valueName parameter? Here is the fixed code:

function changeValue(player, valueName, value)
	
	if dataFolder[player.Name][valueName] then
		dataFolder[player.Name][valueName].Value = value
	end
	
	checkMastery(player)
	
	remote:FireClient(player, "GiveData", dataFolder[player.Name])
	
end

I’ve noticed that roblox shows multiple lines if you’re invoking or using functions and that is why I’m confused.

In my opinion, I don’t think the line you provided is the one with the error which indicates that it’s somewhere inside the bindablefunction.

Maybe send a screenshot of the output. This way, we can see all the lines.

but value.Name isint the name of the value

i use value.Name for set the valueName variable

Can you please show a screenshot of the output, as I mentioned above?

Thats why it is nil, the value variable has no value.Name property attached to it in that function. Please try the solution, because setting a value to another value instance makes no sense whatsoever.

yes here is it

Please show the stack below the error so that we can see the other lines as well.

(from where it says Stack begin up to Stack end below the error)


here i dont see a stack error

Please provide line 30 of your “Datastore” script AND line 64 of your “Fuwa” script.

It seems like the error has a “stack”, and here there are 2 lines of it. Please send them so I can investigate both.

Data store line 28 - 38

function changeValue(player, valueName, value)
	
	if dataFolder[player.Name][value.Name] then
		dataFolder[player.Name][valueName] = value
	end
	
	checkMastery(player)
	
	remote:FireClient(player, "GiveData", dataFolder[player.Name])
	
end

Fuwa line 63 to 64

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

here is checkMastery

function checkMastery(player)
	if dataFolder[player.Name]["EtcMasteryExp"] >= dataFolder[player.Name]["EtcMasteryExpNeeded"] then
		dataFolder[player.Name]["EtcMasteryExp"] = 0
		dataFolder[player.Name]["EtcMasteryExpNeeded"] = dataFolder[player.Name]["EtcMasteryExp"] + math.random(150, 350)
		dataFolder[player.Name]["EtcMastery"] = dataFolder[player.Name]["EtcMastery"] + 1
		remote:FireClient(player, "GiveData", dataFolder[player.Name])
	end
end

On line 30 of the Datastore script, you have written “value.Name” which is the problem, since that parameter “value” contains a number. Try changing it to “valueName”

Instead of
if dataFolder[player.Name][value.Name] then

You can write
if dataFolder[player.Name][valueName] then

I am not sure if this will work, but consider trying this solution.

I wonder why line 30 is erroring! Maybe it is stated in my post. Please actually implement the fix if you want this post to ever get solved.

Post with solution: Attempt to index number with ' Name ' [Repost] - #17 by CoIorEvent

i do it and now is function i just gonna fix the gui and i will back if the results

thank you soo much and every body that help too, now its working very well