This commit is contained in:
Leshyi committed 2026-11-29 20:20:50 +05:00
1 parent edb7f16cda
commit 1d667306da
2 files changed
+41 -27

No files matched your search

BIN
View File
Binary file not shown.
+41 -27
View File
@@ -7,20 +7,29 @@ local Modes = require(ReplicatedStorage:WaitForChild("ArenaModes") :: ModuleScri
local player = Players.LocalPlayer local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui") local playerGui = player:WaitForChild("PlayerGui")
local arena = Modes.geometry(Modes.Procedural) local arena = Modes.geometry(Modes.Procedural)
type Arrow = {gui: BillboardGui, chevrons: {Model}, faces: {BasePart}, edges: {BasePart}, glow: {BasePart}, color: Color3?, phase: number} type Arrow = {gui: Frame, chevrons: {Model}, faces: {BasePart}, edges: {BasePart}, glow: {BasePart}, color: Color3?, phase: number}
local arrows: {[BasePart]: Arrow} = {} local arrows: {[BasePart]: Arrow} = {}
local SIZE = 156
local HEIGHT = 105
local MAX_DISTANCE = 710
local ANIMATION_RATE = 2 * math.pi / 4.5
local overlay = Instance.new("ScreenGui")
overlay.Name = "ObjectiveArrows"
overlay.ResetOnSpawn = false
overlay.IgnoreGuiInset = true
overlay.ScreenInsets = Enum.ScreenInsets.None
overlay.DisplayOrder = 8
overlay.Parent = playerGui
local function build(marker: BasePart) local function build(marker: BasePart)
if arrows[marker] then return end if arrows[marker] then return end
local gui = Instance.new("BillboardGui") local gui = Instance.new("Frame")
gui.Name = "ObjectiveArrow" gui.Name = "ObjectiveArrow"
gui.Adornee = marker gui.AnchorPoint = Vector2.new(.5, .5)
gui.AlwaysOnTop = true gui.Size = UDim2.fromOffset(SIZE, SIZE)
gui.LightInfluence = 0 gui.BackgroundTransparency = 1
gui.MaxDistance = 710 gui.Visible = false
gui.Size = UDim2.fromOffset(164, 164)
gui.StudsOffsetWorldSpace = Vector3.yAxis * 13
gui.Enabled = false
local viewport = Instance.new("ViewportFrame") local viewport = Instance.new("ViewportFrame")
viewport.Name = "ArrowViewport" viewport.Name = "ArrowViewport"
@@ -33,7 +42,7 @@ local function build(marker: BasePart)
local camera = Instance.new("Camera") local camera = Instance.new("Camera")
camera.FieldOfView = 31 camera.FieldOfView = 31
camera.CFrame = CFrame.lookAt(Vector3.new(0, 0, 9.7), Vector3.zero) camera.CFrame = CFrame.lookAt(Vector3.new(0, .8, 9.7), Vector3.zero)
camera.Parent = viewport camera.Parent = viewport
viewport.CurrentCamera = camera viewport.CurrentCamera = camera
@@ -66,7 +75,7 @@ local function build(marker: BasePart)
end end
arrows[marker] = arrow arrows[marker] = arrow
gui.Parent = playerGui gui.Parent = overlay
end end
local function add(instance: Instance) local function add(instance: Instance)
@@ -85,24 +94,29 @@ local added = arena.DescendantAdded:Connect(add)
local removing = arena.DescendantRemoving:Connect(remove) local removing = arena.DescendantRemoving:Connect(remove)
for _, instance in arena:GetDescendants() do add(instance) end for _, instance in arena:GetDescendants() do add(instance) end
local render = RunService.RenderStepped:Connect(function() local renderName = "HunterObjectiveArrows"
RunService:BindToRenderStep(renderName, Enum.RenderPriority.Camera.Value + 3, function()
local camera = workspace.CurrentCamera local camera = workspace.CurrentCamera
local active = player:GetAttribute("InArena") == true and camera ~= nil local active = player:GetAttribute("InArena") == true
local now = os.clock() local now = os.clock()
for marker, arrow in arrows do for marker, arrow in arrows do
arrow.gui.Enabled = active and marker:GetAttribute("ObjectiveArrowHidden") ~= true if not active or not camera or marker:GetAttribute("ObjectiveArrowHidden") == true
if not arrow.gui.Enabled or not camera then continue end or (camera.CFrame.Position - marker.Position).Magnitude > MAX_DISTANCE then
local distance = (camera.CFrame.Position - marker.Position).Magnitude arrow.gui.Visible = false
if distance > arrow.gui.MaxDistance then continue end continue
local phase = now * 3 + arrow.phase end
local size = math.clamp(math.floor(174 - distance * .11), 104, 174) local projected = camera:WorldToViewportPoint(marker.Position)
arrow.gui.Size = UDim2.fromOffset(size, size) local phase = now * ANIMATION_RATE + arrow.phase
arrow.gui.StudsOffsetWorldSpace = Vector3.yAxis * (13 + math.sin(phase) * 1.05) local y = projected.Y - HEIGHT + math.sin(phase) * 7
local spacing = 1.15 + math.sin(phase - .9) * .24 local screen = camera.ViewportSize
arrow.gui.Visible = projected.Z > 0 and projected.X >= -SIZE / 2 and projected.X <= screen.X + SIZE / 2
and y >= -SIZE / 2 and y <= screen.Y + SIZE / 2
if not arrow.gui.Visible then continue end
arrow.gui.Position = UDim2.fromOffset(projected.X, y)
local spacing = 1.15 + math.sin(phase - .9) * .16
for index, chevron in arrow.chevrons do for index, chevron in arrow.chevrons do
local level = 2 - index chevron:PivotTo(CFrame.new(0, (2 - index) * spacing, 0))
local tilt = CFrame.Angles(math.rad(-8), .22 + math.sin(phase * .72 + level * .35) * .26, 0)
chevron:PivotTo(CFrame.new(0, level * spacing, 0) * tilt)
end end
local color = marker.Color local color = marker.Color
if arrow.color ~= color then if arrow.color ~= color then
@@ -118,6 +132,6 @@ end)
script.Destroying:Once(function() script.Destroying:Once(function()
added:Disconnect() added:Disconnect()
removing:Disconnect() removing:Disconnect()
render:Disconnect() RunService:UnbindFromRenderStep(renderName)
for _, arrow in arrows do arrow.gui:Destroy() end overlay:Destroy()
end) end)