Issue with parts being replicated on the client but movable by other clients

I am having a issue in my game where a player is able to move my box that is created by my client with their character.

I want to find a solution to avoid other characters being able to collide with boxes that aren’t created by their client.

It feels like I have tried a lot but I really haven’t I really want to avoid jogging with like 5 different collision groups I just want to find a way to fix this issue which just seems so simple yet so complicated for no reason. Like why are other players able to collide with parts that are being generated by my client im so confused.

The “Box” part is unanchored and so are its childrens which are “Main” and “Outside” both of these parts are welded to the “Box” part.

Here is what happens:

This is how I create the box on the client:

local function regeneratePlayerBoxes(playerToRegen)
	local boxesFolder = workspace:WaitForChild("Boxes")
	local existingPlayerFolder = boxesFolder:FindFirstChild(playerToRegen.Name)
	if existingPlayerFolder then
		existingPlayerFolder:Destroy()
	end

	local plrFolder = Instance.new("Folder")
	plrFolder.Name = playerToRegen.Name
	plrFolder.Parent = boxesFolder

	local boxesTemplate = getCurrentBoxTemplate()
	local boxesClone = boxesTemplate:Clone()
	local positionParts = workspace:WaitForChild("BoxPos"):GetChildren()
	local totalBoxes = #positionParts

	for i = 1, totalBoxes, 10 do
		local endIndex = math.min(i + 10 - 1, totalBoxes)
		for j = i, endIndex do
			local positionPart = positionParts[j]
			local boxToClone = nil

			local colourValue = positionPart:FindFirstChild("Colour")
			if colourValue then
				local colourFolder = boxesClone:FindFirstChild("Colour")
				if colourFolder then
					boxToClone = colourFolder:FindFirstChild("Box")
				end
			end

			if not boxToClone then
				local normalFolder = boxesClone:FindFirstChild("Normal")
				if normalFolder then
					boxToClone = normalFolder:FindFirstChild("Box")
				end
			end

			if boxToClone then
				local newBox = boxToClone:Clone()
				newBox.CFrame = positionPart.CFrame
				newBox.Main.CFrame = newBox.CFrame
				newBox.Outside.CFrame = newBox.CFrame
				newBox.Parent = plrFolder
			end
		end
		task.wait(0.1)
	end
	boxesClone:Destroy()
end

I assume the other clients can’t see the box but can interact with it, this is a CollisionGroups issue. Add 1 collision group per player and make it so the box will only collide with that respective client.

1 Like

yeah im already juggling between 3 diff coll groups for other stuff I guess ill have to rework some of it in that case if thats the only solution thanks!

Actually collision groups wouldn’t work cause my client doesn’t know the collision group of the boxes of the other player since I cannot see them on my client

could have the server register a collision group that uses the player name, then make that group only collide with itself and the default group

then put the player body parts under that group, and the box use the group aswell, will only collide with its matching player

yeah but since the boxes are only visible and handled by the client then other clients won’t be able to tell that my boxes have a diff collision group than the default one so collision groups are just not a option

The solution was to put other client’s torso’s to cancollide false

the other clients wouldnt be able to collide with the boxes, as they are on a noncollidable group

player 1 has a group named player1
player 1’s body parts are also under this group
that group can only collide with default and itself

player 2 has a group called player2
player 2’s body parts are also under that group
that group can only collide with default and itself

they wouldnt be able to collide as long as you properly reigster and unregister the groups on the server