Hi, so I just came across weird behavior with Region3’s, and I just wondered if there was any sort of cap to the size you can set Region3’s to. Basically, I have a system in place where it removes your items if you’re not inside of the store bounds, however, after some testing even if I’m still within the bounds of the store, it removes my tools regardless, only if I’m in a certain position though, so that lead me to thinking of the size of the Region3 I made was capped off?
Not sure, here’s the code I used:
local out_of_range = script.Parent:WaitForChild("Out_Of_Range")
local store_bounds = game.Workspace:WaitForChild("Bounds") --A part that's the bounding box of the entire store
local size, pos = store_bounds.Size, store_bounds.Position
local region = Region3.new(Vector3.new(pos.X - (size.X / 2), pos.Y - (size.Y / 2), pos.Z - (size.Z / 2)), Vector3.new(pos.X + (size.X / 2), pos.Y + (size.Y / 2), pos.Z + (size.Z / 2)))
local function Player_In_Store()
local parts = game.Workspace:FindPartsInRegion3(region, nil, 9999)
for i, part in pairs(parts) do
if part:IsDescendantOf(player.Character) then
return true
end
end
end
Thanks for reading. And if anyone’s curious, this function only runs about every second to not completely destroy a person’s processor, lol
Last time I recall, the max volume being like 100,000 or so… could of changed, not too sure.
Not trying to nitpick or anything, but it seems like hes is making one of those “step into this are to open a shop” things, so if an exploiter would want to expand that, it would only be hurting them lol
In my opinion, region3 needs updating, something like bigger volumes and custom shapes for those volumes. I think your way better off just seeing how far the player is from the shop area and opening the shop when the player gets close
local test = (game.Workspace.ShopArea.Position - player.Character.HumanoidRootPart.Position).Magnitude
I guess I’ll do some math to see if the volume is > 100k, but I doubt that it is…
Anyways, I don’t think Magnitude distance checking would work very well, because in more technical terms this is what I’m trying to accomplish: If players inside the grocery store collect items, but then actually leave the store without paying, remove their items.
Just thought I’d make a follow-up post if anybody has similar problems like this one going forward.
I assume the problem was that the Region3 I was making was too large, so I’m guessing it got cut off at a certain size.
I ended up making two Region3’s, both being half the size of the store bounds part I made that surrounds the entire store, I basically cut everything in half.