Unable to cast value to object

When I try this:

local module = require(workspace.MainModule)
game.ReplicatedStorage.requestEvent:FireClient(module)

I get this error:

Unable to cast value to Object 

RemoteEvent:FireClient() requires you specify the player as the first argument. In this case the module is the first argument and will therefore give you this error. You would need to do

local module = require(workspace.MainModule)
game.ReplicatedStorage.requestEvent:FireClient(PLAYER_INSTANCE, module)

You also need to find a way to get PLAYER_INSTANCE or it will produce an error as well so be sure you have the player specified. If you want to send it to everyone in the server you can use RemoteEvent:FireAllClients() which does not require the player argument.

1 Like