Hey! Thanks for making this module, it’s really neat
However, I’m having an issue when using a DragDetector
Basically, my zone seems to not ‘‘Detect’’ a part when I use DragDetector to drag the part inside the zone
Heres a video of what I mean:
My Code (ServerScript):
local Zone = require(game:GetService('ReplicatedStorage').Zone)
local Container = workspace:WaitForChild('Deposit')
local zone = Zone.new(Container)
zone.partEntered:Connect(function(part)
print(part.Name)
end)
zone.partExited:Connect(function(part)
print(part.Name)
end)
Hello there, I am having a problem with getting touching zones of a player. I have a localscript with these 2 lines of code:
local ZoneController = require(game:GetService("ReplicatedStorage").Zone.ZoneController)
local touchingZonesArray, touchingPartsDictionary = ZoneController.getTouchingZones(game.Players.LocalPlayer)
print(touchingZonesArray, touchingPartsDictionary)
However, this returns an empty array and a nil value, and I have no idea why. I also tried to modify it a bit and run it as a command in the command bar, but it also gave the same empty and nil values. Could someone help me with this?
local ZoneController = require(game:GetService("ReplicatedStorage").Zone.ZoneController)
local touchingZonesArray, touchingPartsDictionary = ZoneController.getTouchingZones(game.Players.LocalPlayer.Character.HumanoidRootPart)
print(touchingZonesArray, touchingPartsDictionary)
and now its working as expected.
What confuses me is that in the documentation it seems as it takes the player as an input, and not the humanoidrootpart. I had to go look in the ZoneController modulescript itself to find the fix.
I have zones which are cloned from ServerStorage with scripts inside which initiate the zones. This script works the first time it is cloned, but for some reason won’t work after. It would be too messy to do this with the rotation (which I’ve tested, and the zones work like that) as the rotation is for maps and is too general, which is why I have scripts inside those maps.
This is a great module, but sometimes for some reason all the zones just break upon test playing. I don’t see any errors in the output as well, the enter/leave detection just doesnt work for zones. What might be causing it?
local part = game:GetService("ServerStorage").Part
local scriptOg = true
local p
while true do
scriptOg = not scriptOg
local p2 = part:Clone()
if p then
--task.delay(0, function()
p:Destroy()
--end)
end
p = p2
p.Enabled = true
p.Parent = workspace
task.wait(10)
end
but this script will:
local part = game:GetService("ServerStorage").Part
local scriptOg = true
local p
while true do
scriptOg = not scriptOg
local p2 = part:Clone()
if p then
task.delay(0, function()
p:Destroy()
end)
end
p = p2
p.Enabled = true
p.Parent = workspace
task.wait(10)
end
Like I said in the original post, the map rotation is a pretty general script, it’d be pretty silly to have so many if statements checking for the name of the map and if it matched up. I could also alternatively have a module script inside which is required (like a “package” of sorts) but I doubt that would solve the issue.
I think this is the best way of making the container, I’m not making it on the same map as the map is destroyed after it’s use (it’s clone, at least)
Figured out why task.delay works. It was delaying it to after p was set to p2 so it deleted the new one and kept the old. Still don’t know how to make a new zone in a disabled script in map cloned.
so basically, I have a tycoon game where I use zones to detect door and garage enters/leaves. (& more)
I have set up everything right and it worked most of the time, only sometimes upon playing the game all zones in the game start to break and for some reason my audios linked to sound groups also get affected by this (they just unlink), I’m not sure how it’s relevant.
I can show you some code but like I said, all zones sometimes work or sometimes none do. I have removed the onEnter(Player) functions and typically put in print statements to detect Enters and Leaves but that leaves me with no outputs, I also use zones for region detections from different scripts and they also do not seem to work when the zones break. It’s all or nothing.
Now I am wondering, is there a cap on how many zones you can use?
Anyway to get around :setaccuracy() changing the accuracy of all zones. This is very annoying and doesn’t allow us to have different zones with different accuracy. I’m guessing I’d have to rewrite the _formHeartbeat function in zonecontroller to make a heartbeat connection for each zone, but I don’t know how performant that would be