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.

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

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