[v.158] SimpleZone | A simple, fast and new Zone module!

hi, what is section? the array you pass into fromParts should be purely baseparts

It is.

Zones > Sections (Hallways, Interior)

1 Like

I see… can you try adding more parts to the zone and see if it still doesn’t work?

I have and it still doesn’t work. This is a crucial method I’m needing.

oof, if you can send a replication place ill go to my laptop and test the issue; i have a feeling i know what it is

ZoneRepo.rbxl (87.4 KB)

1 Like

hi, after some testing it seems the issue is actually just with streamingenabled; waiting a bit at the start i was able to get the zones to work

if your planning to make some kinda music zone thing id recommend using collectionservice and tags because theyll be added when the instance is streamed into the client, very reliable

you can use lesssimplezone to update the volume of 1 zone continuously when new tagged zones are added (detected via collectionservice.getinstanceaddedsignal), this is what i do for the music zones in my own game

1 Like

Ah did not think streaming would do that especially so close to the spawn lol…Thanks!

I’ll look into the LessSimpleZone, but would prob need an example of seeing how to do the updating volume part.

1 Like

Hi, for some reason my code with this module doesn’t detect the parts that are children of the model ā€œTrainā€. Their collision is off.

local zoneOptions = SimpleZone.QueryOptions.new()
	zoneOptions.FireMode = "OnEnter"
	local collisionZone = SimpleZone.fromBox(_currentRoadsFolder.CollisionZone.CFrame, _currentRoadsFolder.CollisionZone.Size, zoneOptions)
	collisionZone:BindToHeartbeat()
	local debounce = true
	collisionZone:ListenTo("Part", "Entered", function(part)
		print(part)
		if part:IsDescendantOf(Train) and debounce then
			debounce = false
			task.wait(10)
			debounce = true
		end
	end)

By looking at what gets printed in the output, I also noticed that when a player goes into the zone, it only detects its HumanoidRootPart and not the rest.

What am I missing?
thanks :+1:

1 Like

Hi, if this is for a train i can spot a few possible causes to the issues you’re having:

  1. You’re listening for Part’s, if your game is R15 that means all your body parts except for the HumanoidRootPart will be a MeshPart, try listening to BasePart/BodyPart instead.
  2. If your train is moving, id try using SimpleZone.fromPart() as that’ll follow the zone part

Can you try applying these fixes to see if your issues get resolved? Lmk if they don’t, thanks in advance

1 Like

Thanks for replying!
The train is moving, but i dont care about the characters. (I shouldn’t have mentioned the humanoidrootpart thing)
I care about detecting when the train enters my zone, not when players enter the train or anything like that.

1 Like

Yes, have an invisible, non cancollide and non canquery zonepart attached to your train parts via a weld and construct a zone using .fromPart(), it’ll follow the train part

Oh, I forgot to mention, BindToHeartbeat actually uses a default OverlapParams that only includes player characters, this means you should pass your own overlapparams into it (or if you don’t wanna bother just do Zone:BindToHeartbeat(OverlapParams.new()))

Passing my own overlapparams did the trick! Thanks man

1 Like

Hi, I have a concern regarding the zone’s detection accuracy, as I’m using it for a rather competitive game.
It appears that when the zones are large (smaller zones mean smaller margin of error) there’s a fair amount of studs you can go outside of the zone without it actually registering. For most games this wouldn’t be an issue, but for my game this can be used for a fairly significant competitive edge.

Is there any way to improve the module’s accuracy, or should I modify my current code to accomodate it?

See attached video for example.

1 Like

Hi, what version of SimpleZone are you using, and do you have any invisible parts attached to the character?

Also, please send a reproduction place .rbxl file so I can debug what the issue is, thanks in advance :slight_smile:

Hey, thank you for getting back to me! Attached you’ll find the .rbxl file. I’m on v158 of SimpleZone, and I’m using the base r6 character with no further invisible parts or attachments. From my own testing, it seems that the smaller zones have very little to no margin of error, whereas the larger ones do. It does appear to ā€œcap outā€ so to speak beyond a certain size. I’m not sure if this is a problem with cylinders only.

simplezonetest.rbxl (82.5 KB)

1 Like

Hi, unfortunately this seems to just be a thing with Roblox’s spatial query api which takes use of bounding boxes; here as you can see the bounding box does overlap with the cylinder even though it looks like my body is standing outside of it

I’m pretty sure theres no way to fix this other than using a custom checking function which uses oriented boxes instead of axis aligned boxes, which it just so happens LessSimpleZone has! (in the form of LessSimplZone:IsBoxWithinZone()), lmk if it still doesn’t work using it

Hi, I apologize for getting back to you so late.

Unfortunately I don’t think adding a custom checker with LessSimpleZone fits my specific use case. I found out after some testing that adding a LessSimpleZone only works with two or more parts, when I only have (and need) one, and I’m not skilled enough to make it performant for checking ~200 players at once.

Thank you for taking the time to answer my questions!

1 Like