Okay. I checked and I did properly use a colon instead of a period:
local players_array = platform1_zone:getPlayers()
Okay. I checked and I did properly use a colon instead of a period:
local players_array = platform1_zone:getPlayers()
Try zone.playerExited instead of zone.PlayerExited
Sorry. I am using playerExited instead of PlayerExited. The forum post this morning was just from memory on my phone. Looking at the code now, it appears I’m using the correct method calls.
platform1_zone.playerExited:Connect(function(player)
--local players_array = platform1_zone:getPlayers()
--if #players_array == 0 then
attachment1.Parent = platform:WaitForChild("Position1")
reset_buttons()
--end
end)
I’m failing to see what exactly is erroring?
There are no errors. Just that occasionally the following task is not performed when the players array is nil:
attachment1.Parent = platform:WaitForChild("Position1")
reset_buttons()
I am not able to reproduce it consistently so I’m not sure what causes it. My guess is a disconnecting or dying player while in the zone.
Thinking about this some more. It’s possible the problem is due to network ownership. I have a few ideas I will test out and then report back.
Your code has the logic check commented out.
Hi!, i have been using this module for a bit and it is great
I have run into a problem though, when i do getParts() in a zone, it returns a completely different array of parts than what they should actually be
These are the only parts it should return
But it returns… this???
The code is pretty straightforward, and yes, “RobberyZone” is actually inside Bank and it is the model i showed earlier
Am i doing something wrong? I would be very thankful if you could help me. Any extra info you might need, ask. Thanks!!
Yes, I commented it out because it wasn’t working. It was copied and pasted from live production code.
Is there a way to make a pass over a zone to see which of these instances need to be removed?
For anyone stuck when resetting character in the zone I built a simple little work around code to restart the sounds when resetting and spawning within the same zone.
while true do
if (insertZoneName)Zone:findPlayer(game.Players.LocalPlayer) and not (insertZoneName)Sound.IsPlaying then
-- Player has reset in the Zone and the sound isn't playing
(insertZoneName)Sound:Play()
fadeSoundIn((insertZoneName)Sound, MAX_VOLUME_INSIDE)
end
task.wait(1) -- Wait for 1 second before checking again
end
end
-- Call this function at the bottom of your local script
ensureZoneSoundPlaying()```
“Zone.Signal:159: Attempt to get Connection::_fn (not a valid member)” what does this error mean ? Every times zone.itemExited fires i get it
the error occur when i do zone.itemExited:Connect(OnItemExited)
had to do this instead :
zone.itemExited:Connect(function(item)
OnItemExited(item)
end)
Awesome Module.
But it would be cool if it got a rewrite for a cleaner structure with full strict type checking, and proper signal implementation for disconnecting events.
Hello, this probably won’t resolve the problem, but for a better syntax, use zone.itemExited:Connect(OnItemExited), bye.
you cannot do that, as i said if i do zone.itemExited:Connect(OnItemExited) i get this error : Attempt to get Connection::_fn (not a valid member). So i do it like that :
zone.itemExited:Connect(function(item)
OnItemExited(item)
end)
Oh, sorry. Didn’t read all, try checking the last version or if you modified any of the code.
Hi there! I’m currently encountering an issue where “items” (or just baseparts) are not being detected entering or exiting a zone.
The code below:
local Zone = require(game:GetService("ReplicatedStorage").Zone)
local zone = Zone.new(script.Parent)
zone.itemEntered:Connect(function(item)
print(("%s entered the zone!"):format(item.Name))
end)
zone.itemExited:Connect(function(item)
print(("%s exited the zone!"):format(item.Name))
end)
Game setup: