Hey, could you hep me out with implementing itemEntered/itemExited? On the docs it says:
zone.itemEntered:Connect(function(item)
print(("item '%s' entered the zone!"):format(item.Name))
end)
But that code doesn’t run, and I’m guessing items are set up differently but I couldn’t find any info on that. However, using partEntered/partExited works with that same code (changed event names) so I’m a bit confused here.
Hey, this is probably an issue due to my coding, but I have a problem where resetting itemEntered doesn’t work.
This code is in a module on the client and is ran when a part is made
--Using the Zone+ module to detect when something enters the hitbox
local hitbox = Zone.new(part)
--track anythhing that has a humanoidrootpat
for _,v in pairs(workspace:GetChildren()) do
if v:FindFirstChild("HumanoidRootPart") then
hitbox:trackItem(v)
end
end
--detects when the tracked item entered
hitbox.itemEntered:Connect(function(Target)
warn("Hit")
part.Color = Color3.fromRGB(170, 0, 255)
outline.Color3 = part.Color
Hit:FireServer(Target)
end)
Him doing that would also mean that he wouldn’t be able to be agressive with API changes that break backwards compatibility without creating another model.
It would also mean that he could change something and it would break your game accidentally.
IIRC, TopBar v1 had ID requiring support, but that was dropped in V2, and I can understand why, since it’s a bad practice. I believe he wouldn’t go back and start supporting it.
Well, don’t worry about that. Update if anything breaks, or periodically with all the libraries you use. I’m an update freak but yeah I don’t see it being much of an issue.
Edit: you can also have notifications on GitHub releases on his repo, so you’ll know if anything important gets fixed
I have some problems with localPlayerEntered event it doesn’t fire.
local zonemod = require(game.ReplicatedStorage.Zone)
local Zone = zonemod.new(workspace.TESTZONE)
Zone.localPlayerEntered:Connect(function()
print("hitt")
end)
is deleting the parts of a zone safe on memory or do I have to make the zone nil too?
I can still print the actual zone after deleting its parts and even disconnecting it
Is there a way I can dynamically remove and add parts from a zone? For example, I have a table of parts that will constantly have values removed/added from them:
local parts = {workspace.Part1} -- workspace.Part1 will successfully print "part detected"
local zone = zones.new(parts)
zone.localPlayerEntered:Connect(function()
print('"part detected"')
end)
foo.Event:Connect(function(bar)
table.insert(parts, bar) -- `bar` will not print out "part detected"
end)
EDIT 1
So in order for the module to consider newly inserted parts in the table, I had to call zone:_update() immediately after inserting/removing a part. This is clearly a hacky method the API doesn’t have this method, but it will do for now.
local parts = {workspace.Part1} -- workspace.Part1 will successfully print "part detected"
local zone = zones.new(parts)
zone.localPlayerEntered:Connect(function()
print('"part detected"')
end)
foo.Event:Connect(function(bar)
table.insert(parts, bar) -- `bar` will now print out "part detected"! yay!
zone:_update()
end)
Hello, is there any way I can make this module work with collision groups. I have a collision group with pets that do not collide with each other, and I want to know if any points enter the zone. If there is no way for the module to do that, are there any other methods to enable me to do so? Thank you!
In pairs does not seem to work for me. Been messing with it for a few hours, still can’t figure it out… In the video below, notice keep an eye out for where it says “Entered” & “left” zone so you can see which zones are calculated.
Here is my code:
local LocationCD = false
function ReloadLocationCD()
LocationCD = true
wait(0.3)
LocationCD = false
end
for _, group in pairs(game.Workspace.LocationParts:GetChildren()) do
local zone = ZoneM.new(group)
zone.localPlayerEntered:Connect(function()
warn("entered a zone")
if LocationCD == false then
script.Parent.Thought.Thought.Event:Fire(".. " .. group.Name .. " ..")
AtmosphereModule:ChangeLocation(group.Name)
ReloadLocationCD()
end
end)
zone.localPlayerExited:Connect(function()
warn("left a zone")
if LocationCD == false then
AtmosphereModule:ChangeLocation("global")
ReloadLocationCD()
end
end)
end
been a long time user of this module, its just great! Recently trying to use this in an obby game and I have notice that zones dont fire event unless the HumanoidRootPart of the character enters the zone.
I did a quick test where only the feet of the character touch the zone, and the events dont fire. I seem to remember this module was able to detect partial parts of a players character, am I remembering things wrong?
ALSO: The API section of the docs site is empty, theres nothing in there. Introduction - ZonePlus
Yo I got a question. Is there a way to get the specific part collided with to fire zone.playerEntered? For example, lets say I have parts inside of a folder, which don’t combine to create a new region but they are spread out across an area, but they all have the same function, just runs the code in different areas. How can I get that specific part the player ran into? Great module btw I use it a lot <3
This ability hasn’t been added yet, has it? I see you closed the issue on github but there aren’t any updates.
I have a problem like OP’s where using a workspace part breaks some things. I’ve read that maybe I can use replicated storage zones if I put them within WorldModels? I suppose I’ll experiment with that solution if this isn’t a native ability yet.
Is there any way to detect if a player is already within a zone?
e.g. dialogue boxes starting when you’re within a radius, and exiting when you’re out of a radius.