This had been an issue for quite a bit of time, but it’s gotten very annoying now.
for _, zone_part in pairs(Containers) do
local zones = Zone.new(zone_part)
zones.localPlayerEntered:Connect(function()
if debounce == false then return end
debounce = false
local regioninfo = script:FindFirstChild(zone_part.Name)
local altered = regioninfo.Name
print(altered)
local sound = script.Sound
sound:Play()
local music = regioninfo.Sound
if music.IsPlaying then
TweenAudio(music, 4, {Volume = 0.5})
else
music.Volume = 0
music:Play()
TweenAudio(music, 4, {Volume = 0.5})
end
task.wait(4)
debounce = true
zones.localPlayerExited:Connect(function()
local regioninfo = script:FindFirstChild(zone_part.Name)
local music = regioninfo.Sound
if music.IsPlaying then
TweenAudio(music, 4, {Volume = 0})
end
end)
For some odd reason, without dying, the code works flawlessly with no issues. However, after dying, there’s a chance that it will stop working - sometimes it will continue to work, but other times it will throw out error messages. Heck, sometimes it throws up error messages and still works. It’s weird.
Apparently on death, it can’t find it’s own child and treats it as nil, but I have no idea how to solve this. Could anybody help?
(The Module )ZonePlus v3.2.0 | Construct dynamic zones and effectively determine players and parts within their boundaries