RZones serve to track and store the player's location in the different predefined zones within the game, allowing events to be triggered or tracked based on the player's current zone.
In Settings file.
-
chatByZone
(bool): Chat only work by zones -
topBarInfo
(bool): Show current zone in the top bar (recomended)
Can call api in client or server
local zAPI = require(game.ReplicatedStorage:WaitForChild("RZones-RS").API)
- Description: Retrieves the settings module required from zFolder.
- Parameters: None
- Returns: A table containing the settings configuration.
local settings = zAPI.getSettings()
print(settings) -- returns the settings table
- Description: Retrieves the current zone that the player is in based on their identifier.
- Parameters:
identifier
(string or number or player): The identifier used to find the player. Use player name or id or player.
- Returns: The name of the current zone the player is in, or false if the player is not found.
local currentZone = zAPI.getCurrentZone("Player1")
print(currentZone) -- returns the name of the current zone or false if not found
- Description: Sets up a listener for changes to the player's current zone, executing a callback when it changes.
- Parameters:
identifier
(string or number or player): The identifier used to find the player. Use player name or id or player.callback
(function): The function to execute when the current zone changes. Receives the new zone name as an argument.
- Returns: A connection object that can be used to disconnect the listener, or false if the player is not found.
local connection = zAPI.getCurrentZoneChanged("Player1", function(newZone)
print("Player1 has moved to:", newZone)
end)
-- To disconnect:
connection:Disconnect()
- Description: Retrieves the attributes of a specified zone, optionally filtering them by a prefix.
- Parameters:
zoneName
(string): The name of the zone to retrieve attributes from.filterPrefix
(string, optional): The prefix to filter attributes by.
- Returns: A table containing the attributes of the zone, optionally filtered by the prefix, or false if the zone is not found.
local attributes = zAPI.getAttributes("Zone1", "filterPrefix")
print(attributes) -- returns a table of attributes with the prefix, or all attributes if no prefix is provided
- Description: Retrieves a specific attribute from a zone based on a prefix and attribute name.
- Parameters:
zoneName
(string): The name of the zone to retrieve the attribute from.prefix
(string): The prefix used in the attribute nameattributeName
(string): The specific attribute name to retrieve.
- Returns: The value of the attribute, or false if the zone or attribute is not found.
local attributeValue = zAPI.getAttribute("Zone1", "prefix", "attributeName")
print(attributeValue) -- returns the attribute value or false if not found
- Description: Sets the value of a specific attribute in a zone, ensuring the prefix is properly formatted.
- Parameters:
zoneName
(string): The name of the zone to set the attribute for.prefix
(string): The prefix for the attribute name.attributeName
(string): The specific attribute name.value
(any): The value to set for the attribute.
- Returns: true if the attribute was successfully set, or false if the zone was not found.
local success = zAPI.setAttribute("Zone1", "prefix", "attributeName", "newValue")
print(success) -- returns true if the attribute was set, or false if the zone was not found