Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

RemoteFunction is "Unable to Cast Value to Object"?

Asked by 4 years ago

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.

01local Config = require(game:GetService("ReplicatedStorage").Configuration.Config)
02function Questions()
03    local Dictionary = Config.MultiDictionary()
04    for _,i in pairs(Dictionary) do
05        local Answer = game.ReplicatedStorage.Question:InvokeClient(i)
06        repeat wait() until Answer
07        table.insert(Answers,#Answers+1,Answer)
08        Number = Number +1
09    end
10end

Here are the parts of the ModuleScript.

01local MultiQuestions = {
02    Q1 = {"Please select your choice.","A","B","C"}
03}
04local module = {}
05 
06function module.GetSize()
07    local count = 0
08    for _,_ in pairs(MultiQuestions) do
09        count = count+1
10    end
11    return count
12end
13 
14function module.MultiDictionary()
15    local Question = {}
View all 21 lines...

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

Log in to vote
1
Answered by
Fifkee 2017 Community Moderator Moderation Voter
4 years ago

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

Ad

Answer this question