Server Remote Event not Firing

  1. What do you want to achieve? Fire a remote event to a module script that acts as a local script

  2. What is the issue? It won’t fire despite being connected to the script

  3. What solutions have you tried so far? Making sure everything is spelt correctly. No errors in logs either

Below is the server script:

local player = game:GetService("Players").PlayerAdded:Wait()

local paper = game.Workspace:WaitForChild("Paper")
local clicker = paper:WaitForChild("ClickDetector")
local pug = game.Workspace.House:WaitForChild("Pug")

local paperUI = player.PlayerGui:WaitForChild("PaperUI")
local paperUI_Button = player.PlayerGui.PaperUI.ImageLabel:WaitForChild("ImageButton")

clicker.MouseClick:Connect(function()
	if paperUI.Enabled == false then
		paperUI.Enabled = true
		pug:Destroy()
	end
end)

paperUI_Button.MouseButton1Click:Connect(function()
	paperUI.Enabled = false

	game.ReplicatedStorage.CutsceneRE:FireClient(player)
end)

Which then fires the CutsceneRE to a module script:

local module = {}

game.ReplicatedStorage.CutsceneRE.OnClientEvent:Connect(function()
print("Hello")

return module

Would I have to reference the player differently, or is there an error somewhere in the code?

hm… not sure why you are doing a remoteevent inside of a module script when you could have just required the module from the server script and used a module function there

Module scripts don’t run until required. This means they also can’t pick up remote events. Instead, you should be firing to the module script. which then fires to the client.

1 Like

Solution as shown above: Server script fires to local script, local script requires module script

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.