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.
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()```
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.
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 :
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)
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)