How would I use streamingEnabled or ServerReplication to have the server stop replicating a part to a certain client

My goal is to have a physical instance in the workspace (model, part, character) no longer be replicated to a specific client or a group of clients.

I have looked on the devloper hub and some said use client scripts to remove the local parts, the problem is that an exploiter could easily use Dex and or just delete the client script that removes them


As you can see, in the first half the part is being replicated like normal, but in the second half the part is no longer replicated to the client, but the server can still replicate to other clients that it wants to

If anyone finds a way to do this or knows a way how or even an alternative that works and prevents exploiting; please let me know

1 Like

You can create a server script that communicates to the client via a remote event.
This method requires you to serialize your part/model.

Heres an example:

--serverscript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlayerService = game:GetService("Players")

local event = ReplicatedStorage.Event

local newInstance = { --serialize part
	ClassName = "Part",
	Name = "newPart",
	Anchored = true,
	Size = Vector3.new(23.5, 7.25, 41.625),
	Position = Vector3.new(12.25, 7.25, 41.625)
	--add extra properties
}

local playersWhoCanSee = {
	3930774500,
	0000000000, --add user ids
}

function makePartVisible()
	for _, Player in pairs(PlayerService:GetPlayers()) do
		if table.find(playersWhoCanSee, Player.UserId) ~= nil then
			event:FireClient(Player, newInstance)
		end
	end
end

task.wait(10)

makePartVisible()
--locascript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("Event")

event.OnClientEvent:Connect(function(instance: {})
	local NewInstance =Instance.new(instance.ClassName)
	instance["ClassName"] = nil
	
	for property, value in pairs(instance) do
		NewInstance[property] = value
	end
	
	NewInstance.Parent = game:GetService("Workspace")
end)
1 Like

This is not what im asking, I’m saying if there is a way for me to stop replicating a part or a model to a certain client, after it has already replicated once

So if I place a part down in the workspace and it replicates to this mystery client, then is there a way on the server I can stop replicating the part to that certian client, but still replicate the part to other clients. What you sent is me is a client sided way to spawn a part for certain players, which is not what im asking

Your best bet is probably to use the method you already know (deleting from the client) since exploiters could spawn in part regardless of whether you safely remove it or not.

2 Likes

The way I want it is that I want to have a another player be streamed to the other client similar to how content Streaming does it, I’m trying to see if there is a way for me to forcefully StreamOut a part or a player then streamIn them whenever I want to

I dont think you can force in/out models unless you do like others have suggested and destroy and clone them via remote event communication. I suggest checking the content streaming documentation.

Now looking at Content streaming docs you could try playing with persistent per player.

OK I’ll check it out and see if I find a way, if I do I’ll mark your answer as the solution, Thanks

1 Like

It has been a week, can we have an update please.

With the way persistent per player works right now I don’t see a way for it to stop continuing the streaming of another player model to another player.

The way it works is that it allows me to choose a model to continue streaming to certain players when they are outside of the streaming range, this means someone across the map would still exist for me if everything else was already streamed out. The problem is that if they are still in the streaming range I can’t just disable them and have them disappear like how they would if I removed the player from the table if they were far away.

In short: Your answer doesn’t work