I am making a placement system with a client made sentry, where it is supposed to collide, but not move with non-player parts in the workspace. However, the sentry i spawned seems to be able to move a tree in the client and replicate the movement into the server which is not what I want.
Video showing the problem in detail: https://youtu.be/HIRyKuVUAyQ
This is strange as I clone the sentry in the client, and it moves server stuff
This is the collision group setting for the sentry, and I made it so that the sentry can collide with regular workspace parts, but not other players or sentries
Below is the script I use to replicate the sentry:
local function AddPlaceholderSentry(attack)
RemovePlaceholderSentry()
sentryToSpawn = attack.Sentry.Value:Clone()
sentryToSpawn.Parent = workspace
for i, object in ipairs(sentryToSpawn:GetDescendants()) do
if object:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(object, "SentryToSpawn")
object.Material = Enum.Material.ForceField
end
end
end
RunService.RenderStepped:Connect(function()
if not sentryToSpawn then
return
end
local result = MouseRaycast(sentryToSpawn)
local x = result.Position.X
local y = result.Position.Y + (sentryToSpawn:GetExtentsSize().Y / 2)
local z = result.Position.Z
local cframe = CFrame.new(x, y, z) * CFrame.Angles(0, math.rad(rotation), 0)
sentryToSpawn:SetPrimaryPartCFrame(cframe)
end)
Post down in the comments if you could help!