Buoyancy Sensor does not work on objects welded to/parented to a user's character.

When using the Buoyancy Sensor to detect if a humanoid should be losing O2, it doesn’t work correctly, regardless of whether or not I set the parent to Head, HumanoidRootPart, or a clone of the head which is parented to the workspace but is welded to the character. The sensor, however, updates on the client, which should not be trusted for the server-side since exploit clients can spoof the values the server expects to receive.

I don’t know if I’m doing the wrong thing to check if a humanoid is submerged underwater, but this seems very odd to have this issue, at least during solo playtesting.

Steps to reproduce:

  1. Create a new script
  2. Create a new sensor object within the script of type “BuoyancySensor”
  3. Set the sensor’s update type to “OnRead”
  4. Set the sensor’s parent to the Head or HumanoidRootPart
  5. Listen to the Sensor’s “OnSensorOutputChanged” event (use a debug print or not)
  6. Run the experience using “Play” or “Play here”

Expected behavior:

The sensor event fires, and updates the values correctly on the server-side where it matters most.

Update:

I just did some extra testing, and RigidConstraint also falls under the list of things you cannot use to attach a sensor to the character without the updates working correctly. Anchoring the sensor part and pivoting it to the part you’re tracking every tick however does work.

3 Likes

From your description, this seems to be the expected behavior. Objects welded or connected to the user’s character will become owned by that player, bringing the sensor with it. As a general rule, properties of instances do not automatically replicate back to the server (there are some exceptions but this is true for most properties). To get the values on the server, you will need to manually synchronize the client and server states via a RemoteEvent.

Eventually, the Server Authority project ([Early Access] Server Authority) will make these issues much easier to deal with. Let me know if you have any questions. Thanks.

3 Likes

That’s dumb… I shouldn’t have to rely on the client, which inherently cannot be trusted for a lot of things, to detect if the user is underwater. This is also not made clear anywhere on the developer documentation that it is intentional behavior for this to not work at all for player characters [edit: server-side]. I cannot wait for the server authority project to enter a proper beta where using it won’t make it so that nobody can join the places then.

1 Like

So you are saying that when a client has physics ownership of the buoyancy sensor, it only updates on that client? This interaction does not agree with other parts of the engine (i.e. Touched events still firing on the server side, even when the touching part is being simulated by a client). Is this documented and is there a workaround?

2 Likes

Any updates on this? Still encountering this issue and would like a fix that’s something other than a janky workaround…