Is there any way else to index when a player has entered another region of Region3? Because every time the loop calls back in my game, which i have on every 5 seconds, creates a snapping lag thing. I’m also using the Aero Game Framework which i love very much, the script is very much working, but i just wish there wasnt that snap, and instead when the player enters another zone it triggers. Here is my code:
local BouldaronPoint1 = RegionMarkers.Bouldaron:WaitForChild("RegionMarker1").Position
local BouldaronPoint2 = RegionMarkers.Bouldaron:WaitForChild("RegionMarker2").Position
local Bouldaron = Region3.new(
Vector3.new(math.min(BouldaronPoint1.X, BouldaronPoint2.X), math.min(BouldaronPoint1.Y, BouldaronPoint2.Y), math.min(BouldaronPoint1.Z, BouldaronPoint2.Z)),
Vector3.new(math.max(BouldaronPoint1.X, BouldaronPoint2.X), math.max(BouldaronPoint1.Y, BouldaronPoint2.Y), math.max(BouldaronPoint1.Z, BouldaronPoint2.Z))
)
local NamaramorePoint1 = RegionMarkers.Namaramore:WaitForChild("RegionMarker1").Position
local NamaramorePoint2 = RegionMarkers.Namaramore:WaitForChild("RegionMarker2").Position
local Namaramore = Region3.new(
Vector3.new(math.min(NamaramorePoint1.X, NamaramorePoint2.X), math.min(NamaramorePoint1.Y, NamaramorePoint2.Y), math.min(NamaramorePoint1.Z, NamaramorePoint2.Z)),
Vector3.new(math.max(NamaramorePoint1.X, NamaramorePoint2.X), math.max(NamaramorePoint1.Y, NamaramorePoint2.Y), math.max(NamaramorePoint1.Z, NamaramorePoint2.Z))
)
local WildernessPoint1 = RegionMarkers.Wilderness:WaitForChild("RegionMarker1").Position
local WildernessPoint2 = RegionMarkers.Wilderness:WaitForChild("RegionMarker2").Position
local Wilderness = Region3.new(
Vector3.new(math.min(WildernessPoint1.X, WildernessPoint2.X), math.min(WildernessPoint1.Y, WildernessPoint2.Y), math.min(WildernessPoint1.Z, WildernessPoint2.Z)),
Vector3.new(math.max(WildernessPoint1.X, WildernessPoint2.X), math.max(WildernessPoint1.Y, WildernessPoint2.Y), math.max(WildernessPoint1.Z, WildernessPoint2.Z))
)
local Wilderness2Point1 = RegionMarkers.Wilderness2:WaitForChild("RegionMarker1").Position
local Wilderness2Point2 = RegionMarkers.Wilderness2:WaitForChild("RegionMarker2").Position
local Wilderness2 = Region3.new(
Vector3.new(math.min(Wilderness2Point1.X, Wilderness2Point2.X), math.min(Wilderness2Point1.Y, Wilderness2Point2.Y), math.min(Wilderness2Point1.Z, Wilderness2Point2.Z)),
Vector3.new(math.max(Wilderness2Point1.X, Wilderness2Point2.X), math.max(Wilderness2Point1.Y, Wilderness2Point2.Y), math.max(Wilderness2Point1.Z, Wilderness2Point2.Z))
)
local SoundRegions = {
Bouldaron = Bouldaron,
Namaramore = Namaramore,
Wilderness = Wilderness,
Wilderness2 = Wilderness2
}
local SoundType = {
Bouldaron = "City",
Namaramora = "City",
Wilderness = "Nature",
Wilderness2 = "Nature"
}
local RegionSound = Instance.new("Sound")
RegionSound.Name = "Region_Sound"
RegionSound.Parent = workspace
RegionSound.Looped = true
RegionSound.Volume = .3
while true do wait(5)
for Table,Item in pairs(SoundRegions) do
for partname, part in pairs(workspace:FindPartsInRegion3WithWhiteList(Item, {Player.Character}, 10)) do
if part.Parent:FindFirstChild("Humanoid") and part.Parent.Name == Player.Name then
local ST = SoundType[Table]
if RegionSound.SoundId ~= "rbxassetid://"..Sounds[ST] then
RegionSound:Stop()
print(Sounds[Table], "Is the sound of the thing you are in")
RegionSound.SoundId = "rbxassetid://"..Sounds[ST]
RegionSound:Play()
end
end
end
end
end