Replicate to one client?

How do I replicate a Instance.new(“RemoteFunction”) from server to only single client(and not replicated to other clients). I tried PlayerGui but it gets destroyed on the client when player resets.

3 Likes

Why are you trying to do this? Why can’t you just put it into ReplicatedStorage and check the player calling it?

I am somewhat confused by your question. Mind offering an example of what you are trying to do?

In Studio, just make one RemoteFunction in ReplicatedStorage. Wherever you have the callback method for it, check what player is calling it (it’s the first parameter). Infinitely simpler than trying to replicate to one client.

What exactly are you trying to ask? The question and content are obscure.

You would make it in the client…

You would literally do

local RemoteEvent = Instance.new("RemoteFunction")
--stuff
RemoteEvent.Parent = game.ReplicatedStorage

As long as filtering enabled is on, anything you do on the client will not replicate (except a few things)

I don’t think you really need to do that though, like everyone else said. Just have one remote function.

Eh - that wouldn’t show on the server - so how exactly is it practically useful?

OP;
You can create a RemoteFunction within the given player’s PlayerGui - IIRC, the server can see that, but other clients can’t.
However, as other people have mentioned, why do you need to do your system in this way? RemoteFunctions already tells you on the server which player sent the request, so it’s just an extra complexity layer to create a RemoteFunction per player, instead of having a single one in ReplicatedStorage for the purpose of that RemoteFunction.


Example file with proof of content: MXKhronos_RemoteFunctionSingleClientExample.rbxl (13.5 KB)
Note: Roblox replicates PlayerGuis if your game is using experimental mode, so this example only works for non-experimental games.

2 Likes

Never said it was useful. Just how to do it. Gotta get those points :wink:

Sorry If I didn’t add in some context. What I’m doing right now is that, on the server side, when the player joins, they get their own data table (functions, score, stats and remotes inside the table), and it’s sent to the client.

I find it much more convenient to create one RemoteFunction per player which calls functions inside those data table, plus, not all clients get the same function in their datatable. I overall just didn’t want to add a couple extra parameters into the RemoteFunction to look for the player’s datatable and its function.

I found this post by @EchoReaper talking about exactly what I wanted. Loading assets too.

I managed to solve my issue, thanks everyone for suggesting.
Everytime my character respawn, I just send the player a new remote and destroy the old one.

Tried another suggestion from @einsteinK and found a hacky way to do what I wanted, creating an instance only visible to one client while also visible to the server.

  • Server Instance.new(“Part”) into PlayerGui of a playerA.
  • PlayerA’s localscript parents that Instance into workspace.
  • Server can still manipulate the instance through PlayerGui.
  • While playerA sees the replication, other players do not see the instance at all.
  • When player resets, the Instance does not get destroy and server can still manipulate the same instance after multiple reset.
  • ???
  • Profit?

This can actually help me with making my local renderer for loading in assets.

10 Likes