I’m using a module called as Zone+, its an easier solution than using region3, and it allows you to make ambient sounds, or sound regions with ease. However…
I’m trying to make something to where you walk into a certain region, and the name of that region pops up on the GUI, except I don’t know how to define a certain zone name. When using Zone+, as seen in the group variable, it defines every single region there, ( i have 3), and when the player walks into one of them it defines that one only.
local ZonePlus = game:GetService("ReplicatedStorage"):WaitForChild("HDAdmin"):WaitForChild("Zone+")
local ZoneService = require(ZonePlus.ZoneService)
local group = workspace.Regions
local zone = ZoneService:createZone("ZoneName", group, 15)
local localPlayer = game:GetService("Players").LocalPlayer
local arcadeZone = ZoneService:getAllZones()
local isClientInZone = zone:getPlayer(localPlayer) -- Checks whether the local player is within the zone
local randomCFrame, hitPart, hitIntersection = zone:getRandomPoint() -- Finds hitpart and other properties
zone.playerAdded:Connect(function() -- Fires when the localPlayer enters the zone
print(localPlayer.Name.." entered!")
local player = localPlayer
local TweenService = game:GetService("TweenService")
local TextLabel = player.PlayerGui.RegionGui.TextLabel
TextLabel.Text = hitPart.Name
local info = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.In,
0,
false,
0
)
local properties = {
TextTransparency = 0,
TextStrokeTransparency = 0
}
local playTween = TweenService:Create(TextLabel, info, properties)
playTween:Play()
end)
zone.playerRemoving:Connect(function() -- Fires when the localPlayer exits the zone
print(localPlayer.Name.." left!")
local player = localPlayer
local TweenService = game:GetService("TweenService")
local TextLabel = player.PlayerGui.RegionGui.TextLabel
local info = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local properties = {
TextTransparency = 1,
TextStrokeTransparency = 1
}
local playTween = TweenService:Create(TextLabel, info, properties)
playTween:Play()
end)
zone:initClientLoop()