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
74 stars 115 forks source link

Some players are not detected #62

Open mesl opened 1 year ago

mesl commented 1 year ago

Using the latest version of ZonePlus, I noticed that when some of my friends join the game, Some newer accounts don't fire the playerEntered (in their localscript) event, I havent figured out why 100% yet because I have trouble reproducing the issue, But it could be related to a longer UserId? Here's how I Managed to reproduce this issue a few times:

If I walk into the zone, The value prints for both me and my friend If my friend walks into the zone, The value will sometimes print for me but not print for my friend If I then leave the game and my friend tries again after I left the game, The value will print for him

I hope this is enough information, I havent completely figured out how to reproduce this as of now

mesl commented 1 year ago

I've been able to isolate this issue further, I haven't been able to replicate this on an alt-account that also has a long userId, so i doubt that is the issue, I've been able to replicate it with userId 4151523582 pretty consistently, The following is what seems to happen: The character does not get detected by the zone at all, The event does not fire The character doesn't need to have a friend in the server, If the player is alone the bug will occur as well The bug seems to happen on a 50/50 chance, if the bug does not happen, relogging will usually make the bug appear, vice versa, having the bug and relogging can make it disappear Sometimes if a friend joins and walks into the same zone, The player gets detected afterwards

mesl commented 1 year ago

I added print statements where zoneplus adds a player and a character, Both of these do get printed from the bugged players perspective with their name I also added a print statement whenever an event is fired internally in the signal class (line 153-154) and this does not fire here either I also added print statements in the Zone class at line 394 in _updateOccupants Printing an table.unpacked previousOccupants will always return empty, unless another player walks into the zone, then it returns their name I also print the line before table.insert(signalsToFire.entered, occupant) for both entered and exited, These do not fire with the bugged player either

mesl commented 1 year ago

I think I have figured out whats causing the issue, I copied all important scripts from my place into a testplace and the zone detection worked there at first (even with the userId 4151523582) But then I realised I delay character loading because of a loading screen and a main menu, So I added an artificial delay to loading in the characters (By disabling autoload in the playerservice and connecting to playeradded in a serverscript on which I wait 5 seconds before loading the character) Doing this made the zone detection stop working for userId 4151523582 but is still working on my main

mesl commented 1 year ago

ZoneDetectionBug.zip Here is my testplace, Keep in mind that it doesnt seem to occur for every player, also keep in mind that even with the UserId I specified before, It doesn't occur 100% of the time

mesl commented 1 year ago

I have temporarily fixed it by changing the FindFirstChild(X) to WaitForChild(X, 3) in function Tracker.getCharacterSize(character) for both Head and HRP

NorteX-dev commented 1 year ago

This is still an issue and the temporary fix mentioned above does not work, at least not long-term.

mesl commented 1 year ago

It's indeed more of a bandaid, not a fix, Which is why I haven't marked this as closed yet

NorteX-dev commented 1 year ago

It's not even a bandaid for me though. For me the detection is still random, about 50/50 between sessions, so it's safe to say nothing has changed for me. Maybe you found any other clues in the 3 weeks since the original was posted so I could try and find a fix?

mesl commented 1 year ago

Since it only happens to some players and isn't 100% reproducible its very hard to say, However I realised that If i delay character loading (By loading the character in manually after a couple seconds) it seems to happen more often, Because the waitforchild 'fixed' the issue for me, It might be related to the different packages' heads?

It was also easier to reproduce in my game, which does a lot of things before loading in the player compared to my test-place, which waits and loads in the player, I don't really know why, but it might help to be aware of this (While in my main place, I could rejoin and 3/4 times I would encounter the issue, in my test place that was more like 1/10 times)

6ixfalls commented 4 months ago

Can you check if the fix in #41 works for you on default accuracy?