Touched events on humanoid root part is sometimes inaccurate and fires off in a loop,

Touched events on humanoid root part is sometimes inaccurate and fires off in a loop. This reproduction is really hard to nail down. As far as I know this bug has existed for a long time. I’m just now trying to track down what’s going on.

Basically, touch events are VERY stable on client owned stuff until the server starts sending events over. So this bug occurs in networked environments only, when you have a touched event on the client and server at the same time.

Further investigation reveals this isn’t the case. Looks like we still get weird behavior here. I can’t get a simple repo to create, however, I know the behavior is wrong/bad. It appears that binding touched on server does SOMETHING.

With binding to touched on server

I added another touched listener on the server. We can see the output here, but also we can see the client is firing off touched events that occured/didn’t occur.

If we didn’t have this binding, we wouldn’t get the client events in this firing loop.

Here’s my attempt to reproduce it.

Sometimes you get the game into this weird state where touched events fire on and off in rapid succesion, and eventually end in a touched ended state. This seems to happen more when there is a moving part moving through the region.

Without binding touched on the server (Expected behavior)

Notice the behavior is normal.

Reproduction

This reproduction is NOT reliable. It’s hard to get to occur sometimes. However, there is a lot of weird behavior here, such as touched firing on and off twice.

TouchedEventsAffectedByBinding.rbxl (22.7 KB)

I’m also happy to send you a file of my current game with this bug in it, but I don’t want to post it on the devforum.

This bug is really hard to nail a simple repo down, I’ve gotten it sporadically in the file, but I haven’t been able to nail it down for the simple repo 100% of the time.

3 Likes

Can you check if there are any un-anchored parts near the part which spams touch events? If there are, can you try anchoring them and see if the problem goes away?

Oh, there definitely are unanchored parts. I suspected these unanchored parts interact in some way with the touched events. However, I explicitly filter out these events before outputting things.

I can’t anchor these parts in my game my game is physics based, and they’re literally just part of the tree. Notes:

  1. Yes there are unanchored parts
  2. These unanchored parts are touching the target part
  3. However, I am listening to the humanoid.RootPart instead of the other part
  4. Even if these parts DID touch the humanoid.RootPart, they are filtered out by my own code
  5. Thus, these parts do not contribute to the output (i.e. it’s not a user error in my logic). I’m certain this is the case because I reproduced the same spamming behavior in that repo place, it just wasn’t consistent.
  6. Even if anchoring these parts DID fix it, I can’t anchor these parts, because they’re part of my gameplay.
  7. I ran a test with anchored parts, and behavior still reproduces.

Here’s the repro:

Thanks!

The reason I ask is because there is currently a known bug in the physics engine that causes this exact scenario when the part is near unanchored parts. I’ve experienced this myself and filed a bug for it internally. I think a fix is on the Physics team’s plate, I can check the status of it later.

1 Like

Oh geeze. Thank you for responding!

That’s maybe what causes it. There’s even more unanchored parts further away.

I am also having this issue with my game

1 Like