I’m having problems with using the :getParts()
function. For some reason, it still returns parts that were inside the region, but are not anymore, until those parts move again.
Essentially, if a player enters using partEntered and then leaves using partExited, the :getParts()
method still returns the parts of the player even though they are nowhere near the zone. partEntered and partExited still work as intended however, which is odd. If i return the part provided by partExited, it very clearly provides parts of the player that aren’t in the zone anymore. getParts()
, on the other hand, says thay are still inside.
In this example, the baseplate turns green when parts are inside the zone, and red when there are none. I walked into the zone (transparent pink part) and it turned green but walking out did not turn red:
I’m printing the results of
getParts()
and the bodyparts are still being returned when they shouldn’t:
As soon as i then move, it realises the parts aren’t in the zone anymore:
Please excuse my bad code here, I was trying to see if it was just partEntered being fired after the last part left or something by constantly checking for parts until there are none anymore:
Essentially, when a part enters the zone, it starts a runservice loop that checks for parts using getParts()
until the number of parts returned is 0, where the connection is terminated and the zone waits for a new part before repeating.
I know this is a terrible solution but i was just trying to work out if it was my implementation or if it was the zone module having issues. It appears to be the latter.
(SharedFunctions:IsTagged()
is just a checker for parts that are tagged. All parts of the player are tagged correctly so this isn’t causing the problem. Same results happen with that omitted)
Any help appreciated!
Edit: The Zone is just being made with that transparent pink part, a normal brick, from this line: