Destroying welds on client breaks physics

In my game players can use explosive blocks to destroy their machines. To do this I destroy welds on the connected to the parts on the client, using BasePart:GetJoints(). The parts and welds for the machine are created on the server and the client has network ownership of every BasePart connected.

If I destroy the welds on the server, I am no longer able to give the client network ownership of the part. I will call :SetNetworkOwner() it runs without error, but when I check after using :GetNetworkOwner() the client does not have ownership and this breaks my game

I can not get this bug to happen in an empty baseplate, I am not sure what about my specific setup I am doing wrong

Are you saying that you destroy the Welds on each Client via Local Script?

This is probably the inverse of the problem reported here:

Local script modifications (especially creating or breaking welds) can cause network ownership, replication, and physics issues. If you destroy a weld on the client make sure you destroy that same weld on the server.

Does that help?

2 Likes

Doing it on the server breaks network ownership, ultimately breaking my game since the map is procedurally generated on the client

The code I use to test + the results. The client loses network ownership of a majority of the parts in the assembly when I start breaking welds on the server. I ran this code after the network ownership breaks

print("Set network owner")

for i,v in pairs(workspace.Machines:GetDescendants()) do 
	if (v:IsA("BasePart") and not v.Anchored) then 
		v:SetNetworkOwner(game.Players.Pixelgrid) 
	end 
end

print("Network owner:")

for i,v in pairs(workspace.Machines:GetDescendants()) do
	if (v:IsA("BasePart") and not v.Anchored) then
		print(v:GetNetworkOwner())
	end
end

print()

wait(1)

print("Network owner after 1 second:")

for i,v in pairs(workspace.Machines:GetDescendants()) do
	if (v:IsA("BasePart") and not v.Anchored) then
		print(v:GetNetworkOwner())
	end
end

print()

image

Network ownership breaks after players use explosives. The welds are destroyed on the server

If you use SetNetworkOwnership API, breaking Welds on the server should not break network ownership. Network ownership should distribute. If it does not, this is a bug.

How do I debug this, is there anything I can do?

If you can provide us with a repro where you have a welded assembly, you call SetNetworkOwner on it, and then you break the welds and each of the parts do not have the same manually set NetworkOwner, we can debug it.

But it is intended that if you have an assembly of parts that are welded together, if you call SetNetworkOwner on any of the parts, if the welds break, NetworkOwnership should persist on all the parts.

The only case where this will break is if you pull all the parts out of workspace, or if you Anchor all the parts.

Do you have the ability to debug it on a live game? I cannot get it to happen in studio, when I copy the broken model from workspace in Play Solo then restart the session, the assembly and network ownership will work fine. Network ownership breaks when I modify a weld from the server when the client has network ownership. Network ownership also breaks if I just set Weld.Enabled to false from the server and after the parts have been anchored the unanchored

NetworkOwnershipDistributionTest.rbxl (23.4 KB)

This is a level I created to test this.

It works both in Studio and in a published game.

If you anchor every part in an assembly, Network Ownership is reset to automatic.

A lot of this is documented in Network Ownership | Roblox Creator Documentation

1 Like

When the network ownership breaks, constraints are enabled but the Active property is false. I cannot reproduce this in studio, I can only get it to happen in-game when players use an explosive block. When a weld is within range of an explosion, I set Weld.Enabled = false first on the server then on the client.

The client also calls Part:ApplyImpulse() after it disabled the weld. After some debugging I found that this bug only happens when I use :ApplyImpulse()

Without ApplyImpulse, network ownership working as expected

With ApplyImpulse, network ownership breaks after first explosion

This is very interesting, thanks for this information. This is definitely a bug!

Can you explain exactly when ApplyImpulse is called? I was unable to repro this on my test place with a ApplyImpulse at the end.

After more debugging, this could be an issue with SpringConstraints PrismaticConstraints. It breaks when a spring gets too far away from origin or is too unstable. I manually deleted the PrismaticConstraint in the spring block after network ownership broke, deleting the PrismaticConstraint fixed it

Breaks at 0:14 when spring gets exploded, network ownership works as expected until then

Hm, the only thing I can think of is if an object goes below the Roblox “Kill Plane” its ownership is reset. Is it possible the constrained object is flying below the “Kill Plane”?

Kindof, I have workspace.FallenPartDestroyHeight = 0/0 which disables it. I do not want the kill plane in my game

Hi just checking in on this. Have you been able to narrow down what may be the cause here? The spring or the ApplyImpulse (or both?)

With ApplyImpulse, network ownership breaks after first explosion

What happens if you call ApplyImpulse with a very small force value? Does it still break?

I haven’t been able to narrow the problem down any more. Physics doesn’t ever freeze anymore, but network ownership still breaks when using explosives + constraints, most commonly springs

im experiencing the same problem when i make a weld on the server it breaks my networkownership even if i set it to the player again please help me!!!