Zone
Parent class of ZoneComponent, ScriptSignal and Metafunctions. Returned by Module.newZone(Fields).
Public
Zone.CharacterResolutionEnum
Zone.CharacterResolutionEnum -- {string: string}
enum.CharacterResolution. Includes CharacterResolutionEnum.FullBody, CharacterResolutionEnum.Root, CharacterResolutionEnum.Head and CharacterResolutionEnum.OnePart.
Zone.QueryTypeEnum
Zone.QueryTypeEnum -- {string: string}
enum.QueryType. Includes QueryTypeEnum.Full and QueryTypeEnum.Bounds.
Zone.StateEnum
Zone.StateEnum -- {string: string}
enum.StateEnum. Includes StateEnum.Paused, StateEnum.Active and StateEnum.Dead.
Zone.PartEntered
Zone.PartEntered -- ScriptSignal
local connection = Zone.PartEntered:Connect(function(oart)
...
end)
Zone.PartLeft
Zone.PartLeft -- ScriptSignal
local connection = Zone.PartLeft:Connect(function(part)
...
end)
Zone.CharacterEntered
Zone.CharacterEntered -- ScriptSignal
local connection = Zone.CharacterEntered:Connect(function(character)
...
end)
Zone.CharacterLeft
Zone.CharacterLeft -- ScriptSignal
local connection = Zone.CharacterLeft:Connect(function(character)
...
end)
Zone.PlayerEntered
Zone.PlayerEntered -- ScriptSignal
local connection = Zone.PlayerEntered:Connect(function(character)
...
end)
Zone.PlayerLeft
Zone.PlayerLeft -- ScriptSignal
local connection = Zone.PlayerLeft:Connect(function(character)
...
end)
Zone.Serial
Zone.Serial -- number
Zone.CharacterResolution
Zone.CharacterResolution -- string
FullBody, Root, Head or OnePart.
Zone.QueryType
Zone.QueryType -- string
Full or Bounds.
Zone.Rate
Zone.Rate -- number
Zone.OverlapParams
Zone.OverlapParams -- OverlapParams
OverlapParams used in spatial query.
Zone.Active
Zone.Active -- boolean
Zone:Activate() and Zone:Deactivate() instead.
Zone:AddMemberBulk(partList: {BasePart})
Zone:AddMemberBulk({part1, part2})
BaseParts into the Zone, automatically intiating their own ZoneComponents and Metafunctions.
Zone:AddMember(part: BasePart, Metafunctions: {string: function})
Zone:AddMember(part, metafunctions)
BasePart into the Zone, automatically initiating a ZoneComponent for it. Metafunctions must be provided. Note: Use Zone:TranslateToMetafunction(part) to generate a basic Metafunction that you can use.
Zone:TranslateToMetafunction(part: BasePart)
local metafunctions = Zone:TranslateToMetafunction(part) -> {string: function}
part.
Zone:RemoveMember(part: BasePart)
Zone:RemoveMember(part)
part from the Zone if it exists, also removing all its associated ZoneComponents and Metafunctions.
Zone:AddComponent(component: ZoneComponent)
local serial = Zone:AddComponent(component) -> number or nil
ZoneComponent to the Zone directly, without the need for a BasePart. Returns the serial of the ZoneComponent if added successfully. Note: Methods dealing with ZoneComponents directly are for advanced use-cases. Do not use unless you know what you're doing.
Zone:RemoveComponent(serial: number)
Zone:RemoveComponent(index: BasePart or number)
ZoneComponent with index from the Zone. ZoneComponent generated from Zone:AddMember() and Zone:AddMemberBulk() have a BasePart index, while ZoneComponent generated from Zone:AddComponent() have a number index (same as its serial).
Zone:Update()
Zone:Update()
Zone:Activate()
Zone:Activate()
Zone:Deactivate()
Zone:Deactivate()
Zone:IsPartInside(part: BasePart)
local isInside = Zone:IsPartInside(part) -> boolean
part is inside the Zone or not based on the Zone's query rules.
Zone:IsCharacterInside(character: Model)
local isInside = Zone:IsCharacterInside(character) -> boolean
character is inside the Zone or not based on the Zone's query rules.
Zone:IsPlayerInside(character: Model)
local isInside = Zone:IsPlayerInside(character) -> boolean
character is inside the Zone or not based on the Zone's query rules.
Zone:GetPartsInside()
local partList = Zone:GetPartsInside -> {BasePart}
Zone:GetCharactersInside()
local characterList = Zone:GetCharactersInside() -> {Model}
Zone:GetPlayersInside()
local playerCharacterList = Zone:GetPlayersInside() -> {Model}
Zone:Destroy()
Zone:Destroy()
Private
Zone._CurrentFrame
Zone._CurrentFrame -- number
Zone._CanWarn
Zone._CanWarn -- boolean
Zone._Visual
Zone._Visual -- BasePart or nil
Zone._MemberParts
Zone._MemberParts -- {BasePart}
Zone._MemberComponents
Zone._MemberComponents -- {BasePart or number: ZoneComponent}
Zone._PartsInside
Zone._PartsInside -- {BasePart}
Zone._CharactersInside
Zone._CharactersInside -- {Model}
Zone._PlayersInside
Zone._PlayersInside -- {Model}
Zone._Destroying
Zone._Destroying -- boolean
true.
Zone._FirstQuery
Zone._FirstQuery -- boolean
true, the next query will not trigger PartEntered, PartLeft, CharacterEntered, CharacterLeft, PlayerEntered and PlayerLeft, then the value becomes false.
The main enum and Metafunctions are intended to be completely private. You are not meant to access them.