I’ve gotten the collisions to work with ZonePlus, now it’s just my implementation of a swimming system in my custom Animate script that I need to fix.
Update, 8/1/2023:
Been testing for more than an hour sifting through the code of the module itself. My issue was that it was checking for a “Head” but my custom character’s head’s name was “head”. Not capitalized. Be sure you change what the code is looking for or you change the head name to “Head”.
I am facing a similar issue, but based on my research, it seems that whenever a part is destroyed within a zone, the zonevolumecustom changes to 256, whereas previously it was in the millions. This behavior seems suspicious.
I have a question about ZoneEvents. Is it possible to disconnect these events whenever we no longer need them?
So if I’m running a script similar to this one:
local item = character:FindFirstChild("HumanoidRootPart")
zone:onItemEnter(item, function()
print("The item has entered the zone!"))
end)
But it tracks the humanoid root part of every player in the game, and then a player decides to leave the game, will it be possible to disconnect the event that is tracking it? Or is this done automatically?
I’m not seeing a way to do this through the API. I’m going to assume there is no need to, as using onItemEnter isn’t necessarily creating a new event, but adding the given item to a list. When the item is destroyed, it’s automatically removed from the list of items needing to be checked in the zone.
I’m stucked with an issue on collision (I guess) with ZonePlus. I can’t clearly debug. Everything seems to be normal from the code logic, but actually something triggers multiple times.
I am creating a zone in server script attached to the part, detecting players enetering and exiting:
local Zone = require(game:GetService("ReplicatedStorage").Zone)
local container = script.Parent
local zone = Zone.new(container)
zone:setAccuracy("Precise")
zone:setDetection("WholeBody")
local ServerScriptService = game:GetService("ServerScriptService")
-- ADD BINDABLE EVENTS FOR SERVER
local Open = ServerScriptService.BindableEvents:WaitForChild("Open")
local Close= ServerScriptService.BindableEvents:WaitForChild("Close")
zone.playerEntered:Connect(function(player)
print(("%s entered the zone!"):format(player.Name))
Open:Fire(player)
end)
zone.playerExited:Connect(function(player)
print(("%s exited the zone!"):format(player.Name))
Close:Fire(player)
end)
The script triggers a bindable event that activates another server script that takes care of handling a timer for the specific user. The problem here is that, I don’t understand why, the while loop seems to be triggered multiple times, athough I can’t clearly intercept multiple fires. The print(“Times”) runs more than once per second. The problem happens when you walk close by the bounds of the zone.
local ServerScriptService = game:GetService("ServerScriptService")
local Open = ServerScriptService.BindableEvents:WaitForChild("Open")
local Close = ServerScriptService.BindableEvents:WaitForChild("Close")
local ON = {}
local function processOpenPlayingSessionEvent(player)
ON[player] = true
-- SESSION MANAGER
while ON[player] == true do
print("Time")
-- do stuff while ON
wait(1)
end
end
local function processClosePlayingSessionEvent(player)
ON[player] = false
end
Open.Event:Connect(processOpenPlayingSessionEvent)
Close.Event:Connect(processClosePlayingSessionEvent)
Can someone please give it a hint? Would be really appreciated. Stucked here for days…
Might I start by saying I love this API, it has made region-based scripts so much easier for me. But I need help. How can I get the info of the region that a player enters in? I want a gui to display the name of the part that the player enters, as well as being able to get a string within the part’s children. Here’s the snippet of code from my script.
-- Zone Controller
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Zone = require(ReplicatedStorage.Zone)
local ZoneController = require(ReplicatedStorage.Zone.ZoneController)
-- Containers
local AncestorContainer = workspace.EnvironmentTriggers -- Makes up all the regions within the folder
-- Zone Variables
local ZoneVar = Zone.new(AncestorContainer)
local localPlayer = game.Players.LocalPlayer
local playerGui = localPlayer:WaitForChild("PlayerGui")
ZoneVar.playerEntered:Connect(function(playerWhoEntered) -- Fire script when they enter
playerGui.RegionGUI.Background.Title.Text = ZoneVar:WaitForChild()
playerGui.RegionGUI.Background.Subtitle.Text = "Adventure Awaits!"
I have a bug where i’m inside a zone and when i run into random parts inside of that zone then sometimes it registers that i’ve left the zone… does anyone have a fix for this?
If a zone is deleted, will it delete the zone related to it, want to use this for a tycoon, but purchases can be removed so gotta be careful not to cause memory leaks.