Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Remote event not firing client?

Here's the code:

game.Workspace.Note.ClickDetector.MouseClick:Connect(function()
	game.ReplicatedStorage.ViewNote:FireClient()
end)

This is a server script, the other side is in StarterGui. Whenever I run this script, it comes up with an error on the middle line. "Argument 1 missing or nil." Is anyone able to help?

1 answer

You're getting this error because the FireClient function requires the player that the RemoteEvent will be firing to. In this case though, you can easily get the player from the MouseClick event because the MouseClick event has a parameter that is the player who clicked the ClickDetector.

game.Workspace.Note.ClickDetector.MouseClick:Connect(function(Player)
    game.ReplicatedStorage.ViewNote:FireClient(Player)
end)

Hope this helps.

This discussion is preserved as it was. New answers, comments, and votes are closed.