Problems with Workspace:GetPartsInPart

Hey y’all! I am currently doing a system which allows me to put parts anywhere on the map and assign them as a region. ← Not region 3. However just a region like: The Bar. Now, I wan’t to check if a player is inside this region. The problem now: I am using Workspace:GetPartsInPart to check if someone is in a region. I have also assigned to the OverlapParms a whietelist with the descancts of my characters body. When I walk now into the Bar, from the Streets it shows me: Streets ; 7 parts in. Bar ; 7 parts in. But that’s totally not true. I am in the Bar, not at the Streets but when I walk out of the Bar it only shows me: Streets ; 7 parts in. Bar; 0 parts in which is now correct. I have no clue how my script get’s to 7 people in the region street when I am completely in the region Bar. I’ll show you a picture which proves BOTH regions are not overlapping:
2022-08-04_18h31_22


The region Street is not overlapping which the region Street so anyone knows how to fix this? :sob:

Script:

while wait(0.5) do
	for _,region in pairs(zones) do 
		--local parts = workspace:FindPartsInRegion3WithWhiteList(region.Region,game.Players.LocalPlayer.Character:GetDescendants())
		--local parts = workspace:GetPartBoundsInBox(region.Object.CFrame,region.Object.Size,overlapParms)
		local parts = workspace:GetPartsInPart(region.Object,overlapParms)
		print(#parts,parts,region.Object.Name)

does your street region overlap your bar region?

I have multiple times said, no.

oh, lol, I just looked at the pretty pictures :stuck_out_tongue:

did you try a third region and see if it shows multiple zones when you are in the third region? That might help narrow down a solution. If it still has street when you are in region 3, then most likely its with the street region.

Wait… I think I have figured it out.So my street was basiclly just a union. Does GetPartsInPart works for Unions exactly too?

I would think it would use the unions bounding box.

can you show me your entire script, i have 50% confidence that i will be able to read through whatever mess that comes my way

i can hardly believe that this below is actually all of your code

while wait(0.5) do
	for _,region in pairs(zones) do 
		--local parts = workspace:FindPartsInRegion3WithWhiteList(region.Region,game.Players.LocalPlayer.Character:GetDescendants())
		--local parts = workspace:GetPartBoundsInBox(region.Object.CFrame,region.Object.Size,overlapParms)
		local parts = workspace:GetPartsInPart(region.Object,overlapParms)
		print(#parts,parts,region.Object.Name)

im currently in the thingg of something. ill do when I finish it and it still doesnt work

could it be possible that its because the character you’ve assigned in overlapParams was an old player and the game didnt pick up on the new player that is created

or is it possible that the script on the server ran, but because the character hasnt been added, it did not add any character to the overlapParams

(i still need your entire script)

Nope. Figured it out somehow. Due to the union the script throught Hmm. Div is surely in Bar and Street. I’m working on a fix and it seems to work!

Fixed! Thanks to everyone for helping me. :slight_smile:

I encountered the same problem w/ a hitbox not being detected, changing it’s renderfidelity from precise to automatic fixed it.