Humanoid.Touched() Problems

I started noticing strange lag spikes about a month ago. I eventually discovered that the problem was related to Humanoid.Touched. I could not find a way to stop the lag spikes. The Microprofiler showed the spikes were a Physics issue, so I assumed it was due to Humanoid.Touched firing a lot. I sorta gave up for a little bit on fixing this. A few days later, I noticed the problem seemed to fix itself. The lag spikes stopped entirely, so I assume Roblox fixed the issue. Well now in my game, I am noticing a different issue: whenever a Humanoid.Touched() event is connected to a player’s humanoid, that player seems to “bounce” away from parts whether or not they have cancollide set to true or false. I tested this by having my character stand inside some tall grass structures that had their cancollide set to false and seeing if they pushed me out. https://gyazo.com/78b187ad85ecf6131903b83c0d419f0c Whenever I stood in them and jumped with no Humanoid.Touched() event connected, my character was able to stand and jump around in them just fine, but whenever I connected a Humanoid.Touched() event to my character, every time I jumped within the grass structure, I was pushed around or pushed out of them. This issue is causing some issues within my game because players will collide with invisible hitboxes before they are removed by the Debris service and it causes them to get pushed around.

1 Like

What’s the humanoid.Touched event doing? If you just set the parts to CanCollide = false then they’d be able to walk through them, if set to true then they’d walk over them, but a humanoid.Touched event shouldn’t change that unless you have that event doing something to affect the player (i.e position)

When I did the test, the Humanoid.Touched() event did literally nothing. I just connected the event. The grass is already CanCollide = false, so I shouldn’t be pushed around in them either way.

If the grass CanCollide is set to false, then no you shouldn’t be pushed around, you should just walk straight through it. Can you show me the script you have running that would be causing the player to ‘push them around’

There isn’t one. In this test, I had a script in serverscriptservice that had a PlayerAdded event with a CharacterAdded event inside and then I typed Character.Humanoid.Touched:Connect(function() end). That’s literally it lol

Hmmm :thinking: I don’t see how that would make a change to the player being pushed around

I don’t either, which is why it’s confusing me because I don’t know how to fix it other than by never using Humanoid.Touched

What do you want the touched event to do?

It detects when my body touches another player, then deals damage

Make a repro place and include it in a post in #platform-feedback:client-bugs. This definitely should not be pushing you around just for connecting it.

1 Like

Alright

Posted it Humanoid.Touched Bug