Questions about Server/Client remote handling

I haven’t used RemoteEvents in scripting for a long time, so my knowledge on them is dull. I do know what they do, but I forgot how the handling on server/client side works.

If I use the following code

remote.OnServerEvent:Connect(function(plr, reci, sub, body)
	-- code
end)

Is plr the player’s name or the player’s obejct/instance?

If I use the following code

-- Server Script
remote:FireClient(plr, "err", s) -- Assume plr is equal to my Instance and s is the error message

-- Client Script
remote.OnClientEvent:Connect(function(t, msg)
	-- code
end)

Is this sending data to the client correctly or not?

1 Like

Plr is the player object of the player who did :FireServer(). In your second bit of code, that should fire the remote event for that client as long as plr is a player object.

3 Likes