I am trying to fire a remote event when a player touched my block. Here is the code:


local guieventsfolder = game.ReplicatedStorage.GuiEvents
local mapevent = guieventsfolder.WinsEvent
local levelsevent = guieventsfolder.LevelsEvent


local bathroombeginningsensor = game.Workspace.Bathroom.Checkpointbathroomfirst

bathroombeginningsensor.Touched:Connect(function(plr)
	mapevent:FireClient(plr,mapevent)
	winsevent:FireClient(plr,winsevent)
	levelsevent:FireClient(plr,levelsevent)

It keeps saying: FireClient:player argument must be a Player object.

Ps:I never really grasped what the second argument is for.please explain. I know the first parameter is the player, but i don't know what the second one is for.

4 comments

0

The second argument is variadic, whatever you continue to pass will be sent to the respective Player, and received via your 'OnClientEvent' callback either in the form of a variadic or positional parameter(s).

0

The Player Object is what is used to represent the connected Client. As it works in the real world, you require to know exactly who you're sending information to. In ROBLOX, as any individual TCP connection, this "individual" is a connected Client, you require this Instance specifically to illustrate who you're sending that information to.

0

If you read the documentation to 'Touched', you would know it provides the BasePart that made contact with the respective BasePart, not a Player Instance, you must filter that out.

0

What are you trying to send anyways? Players char?