I am unsure how to fire an event to a module script from a client script. I have the module script in ServerScriptService. The client (in a GUI in StarterGui) then says “modualScript is not a valid member of ServerScriptService “ServerScriptService””.
local event = game:GetService("ReplicatedStorage").revealAnswerEvent
local revealAnswer = require(game:GetService("ServerScriptService").revealAnswer) --error given
wait(3)
event:FireServer(playerAnswer) --should fire an event to the module script
The descendants of server services (ServerScriptService and ServerStorage) are not replicated to the client. Client code communicates to the server through RemoteEvents; server code receives events through those remotes and then can act accordingly. I’m not sure what revealAnswer is supposed to be but your LocalScript would not be able to access it.
revealAnswer is the name of the module script I am trying to fire an event to. This does not work as the event is not received by the revealAnswer script.
That’s my bad, I missed the require call. You would need a Script instance (implicitly server-sided if using Legacy RunContext) to require the revealAnswer module so it can run on the server and start receiving events from the client through the remote.