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

RemoteFunction is "Unable to Cast Value to Object"?

I've got a ModuleScript that has a dictionary being sent to the script causing the error. I'm pretty sure it's something with it but I can't tell at this point, I'm baffled.

Relevant parts of the ServerScript.

local Config = require(game:GetService("ReplicatedStorage").Configuration.Config)
function Questions()
	local Dictionary = Config.MultiDictionary()
	for _,i in pairs(Dictionary) do
		local Answer = game.ReplicatedStorage.Question:InvokeClient(i)
		repeat wait() until Answer
		table.insert(Answers,#Answers+1,Answer)
		Number = Number +1
	end
end

Here are the parts of the ModuleScript.

local MultiQuestions = {
	Q1 = {"Please select your choice.","A","B","C"}
}
local module = {}

function module.GetSize()
	local count = 0
	for _,_ in pairs(MultiQuestions) do
		count = count+1
	end
	return count
end

function module.MultiDictionary()
	local Question = {}
	for i,v in pairs(MultiQuestions) do
		table.insert(Question,#Question+1,v)
	end
	return Question
end
return module

My main goal (is to blow up, and then act like I don't know nobody) is to have all values placed in a table and sent to a LocalScript with a RemoteFunction.

Error: Unable to cast value to Object - Line 5 (ServerScript)

1 answer

✓ Accepted answer

InvokeClient requires a Player object to send the data to. No point in sending data to nil.

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