Replicating characters' positions to only selective clients

I’m trying to create a game in which multiple mechanics including fog of war occlude players from each other’s view. From an exploit-proactive position, using the default Roblox character replication system sounds lazy. An exploiter would be able to see where everyone is. Because of this, I’d like to have the server restrict who certain characters are replicated to.

From my understanding of default Roblox character replication, the server creates the character model with Player:LoadCharacter() and then relinquishes physics ownership to the player controlling it. The only way I saw to change this replication behavior was to set physics ownership to the server and write some custom replication myself from the client to server and server to selective clients.

However, I found that setting the character’s physics owner to the server only made character movement seem heavy, as if the character was written to go into a mode where it sent movement input to the server when it didn’t have physics control itself. I’m assuming this is what is happening, as movement is still occuring on the server.

If anyone knows if there is a way to either disable this replication behavior and to replicate character positions only to selected clients, preferably without writing a whole new character, and if anyone else has done this before I can take notes from, please let me know, thx.

Here is the code im using to disable character physics ownership btw:

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		-- Deny physics ownership lol
		character.AncestryChanged:Connect(function(instChanged, newParent)
			if instChanged == character and newParent ~= nil then
				for _, inst in pairs(character:GetDescendants()) do
					if inst:IsA("BasePart") then
						inst:SetNetworkOwner(nil)
					end
				end
			end
		end)
	end)
end)
4 Likes

you could always make a local script in startplayerscripts and code it in that case exploiters cant do anything about it also you can also make it server sided btw

but they can delete it on their own client which wont happen
and why are you trying to set network to nil so they cant touch the player?

Client sided anti exploit is fallible and I mentioned in the post why I don’t want some players knowing each other’s locations.

1 Like

Fire to an event on the server from the character you want to be seen. Make that event FireAllClients with some data in it so the clients know if they should show that character. Never tested it before but I would think it would help.

Telling the client whether or not it should display the character isn’t useful since an exploiter can just make them visible again. I need to cut off replication entirely.

2 Likes