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