Remote Event Method FireServer() passing the player argument twice?

  1. What do I want to achieve?

Pretty simple issue. For some reason my remote events are passing the player argument twice? I was under the impression that the FireServer() method automatically passed the player as an argument, so I am unsure as to why the argument itself is being passed twice.

  1. What is the Issue?

The player argument is being passed twice.

LocalScript:

guidePrompt.Triggered:Connect(function(player)
	currentCam.CameraType = Enum.CameraType.Scriptable
	promptModule.moveCameraToGuide(localPlayer, currentCam, workspace.CameraParts.QuestGiver1Part.Position, workspace.Guide.Head.Position)
	guideDialogueEvent:FireServer(player, "GuideDialogue", "test")
end)

Corresponding ServerScript:

guideDialogueEvent.OnServerEvent:Connect(function(one, two, three)
	print(one) -- this prints the player
	print(two) -- this also prints the player
	print(three) -- this prints "GuideDialogue"
end)

I also tried this variation in my ServerScript:

local function startDialogue(player, two, three)
	print(player) -- prints player
	print(two) -- prints player
        print(three) -- prints "GuideDialogue"
end

guideDialogueEvent.OnServerEvent:Connect(startDialogue)
  1. What solutions have I tried thus far?

My best guess was that the fact that the remote event is tied to a proximity prompt, which also passes the player as an argument, is probably somehow interfering with the FireServer() method. However, I have been unable to confirm whether or not that is the issue, and no other variations I tried have worked.

Thanks in advance.

you don’t need to send the player via an argument, OnServerEvent will handle that for you as the first parameter in the callback function so just remove the player parameter in the FireServer function and it should be good

That worked, thanks for the help!

1 Like

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