Local and Server Modules not connecting by RemoteEvent

Local Module

local sendRange = script.Parent:WaitForChild('SendRange')

sendRange:FireServer(id , character, character.Humanoid, touch)
print(1)
arrow:Destroy()
print('Destroy')

Server Module

local sendRange = script.Parent:WaitForChild('SendRange')

    sendRange.OnServerEvent:Connect(function(player, id , character, humanoid, hit)
    	print(2)
    	main:CheckPlayer(player, id , character, humanoid, hit)
    end)

It prints 1 and Destroy, but never prints 2. The SendRange Remote is in the same place. Both the scripts and Event are inside a folder inside RepStorage. Both scripts are modules.

The ‘Local Modules’ function is fired by a LocalScript. Then the event is suppose to transfer that from local to server, as the other module is only ever run by the server.

EDIT I belive I found the problem. I was never requiring the other module, so it was never running. But if I require the server module, then it won’t work, as it references the ServerStorage and all that on it. How can I get a LocalModule to still require a Server Module?

Hmm… Sounding like the server module isn’t receiving anything… Are you requiring the server module?

1 Like

Ye, just posted an edit

You can’t require the server module locally because it uses a server-only function (the OnServerEvent), but, you can require it in a script in ServerScriptService.

So if I just required it from there, the Local module will still be able to fire the event and it’d be picked up??

Yes.

1 Like

A module running in a client environment cannot require a module with the expectation that it will fulfil its server-side duties. A module’s environment is dependent on what conditions were present upon requiring (e.g. type of script, or location, or environment of a ModuleScript that requires another ModuleScript).

1 Like