1ForeverHD / ZonePlus

Construct dynamic zones that utilise region checking, raycasting and the new BasePart.CanTouch property to effectively determine players and parts within their boundaries.
https://devforum.roblox.com/t/zone/1017701
MIT License
76 stars 117 forks source link

[Bug] Players with an applied HumanoidDescription do not fire player events #41

Open 6ixfalls opened 2 years ago

6ixfalls commented 2 years ago

Hey! I recently spent a while debugging why my code wouldn't react to the playerEntered and playerExited events, and after a bit of digging, I found out that when I applied a HumanoidDescription to the player, the player was not recognized by any zones on the server (possibly the client too).

A repro game is linked below: https://www.roblox.com/games/8699903286/ZonePlus-Repro Comment out line 15 in CharacterSetup in ServerScriptService to make the zone work again.

This bug is reproducible on the latest version of ZonePlus, v3.2.0.

1ForeverHD commented 2 years ago

Hi sixfalls, thanks for the repo place! I've played around at the place for a bit and even when trying different start packages, delaying the morph, repeating the applying of different descriptions, it still appears to work fine for me. Are you happy to provide a video or some images with further details? Thanks!

6ixfalls commented 2 years ago

I can send a clip later; it doesn't work no matter what packages. It could possibly be a beta feature I have on?

1ForeverHD commented 2 years ago

Would it be alright for you to try the same thing at the repo place but on an alt or new account? You might be right about it being a beta feature or a certain studio configuration.

6ixfalls commented 2 years ago

Looks like it's just the headless head that makes it not fire; I did some testing and it works fine when I don't have headless equipped.

6ixfalls commented 2 years ago

Bug is reproducible with all beta features disabled, here's a video: https://streamable.com/54of83

1ForeverHD commented 2 years ago

What you mean specifically by headless head? The Headless Horseman head body part for example, or literally no Head instance within the character?

https://thumbs.gfycat.com/SeparatePointlessHomalocephale-mobile.mp4

6ixfalls commented 2 years ago

The headless horseman head, which you can equip on the avatar shop. I'll try to update the repo place to use a custom avatar with headless.

1ForeverHD commented 2 years ago

Ah found it, turns out this bug was being created from a race condition between AncestryChanged and the new replacement Head being swapped in on the same frame.

To fix, simply hop into the 'Tracker' module (under ZoneController) and change line 208 from self:update() to task.defer(self.update, self).

Thanks for your help finding this bug, I'll officially publish this fix alongside the next ZonePlus release.

If this covers everything, feel free to close the issue.

6ixfalls commented 2 years ago

Thanks for the help! The fix worked fine.

6ixfalls commented 1 year ago

@1ForeverHD Sorry for the bump; this issue still occurs when accuracy is set to High. Either keeping the accuracy on default fixes it, or not applying the HumanoidDescription at all.

For an exact reproduction, simply add the line Zone.accuracy = ZonePlus.enum.Accuracy.High to line 4 of the Zone script in the above-linked repro place.