--!strict -- LocalScript in StarterPlayerScripts. -- Kill feed in the top right corner: every kill in the server (ReplicatedStorage.KillFeed: -- killerName, victimName, headshot, killerUserId) adds a row "killer [headshot icon] [rifle] victim". -- Rows the local player made have a yellow frame. Newest at the top, up to MAX rows; each stays -- LIFE seconds, then fades out. The rifle icon is the real SniperRifle model in a ViewportFrame. local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local TweenService = game:GetService("TweenService") local UI = require(ReplicatedStorage:WaitForChild("HunterUI") :: ModuleScript) local LIFE = 6 local FADE = 0.4 local MAX = 5 local NAME_RED = Color3.fromRGB(255, 166, 141) local OWN_FRAME = UI.Gold local DARK = UI.Panel local OUTLINE = Color3.fromRGB(20, 20, 28) local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local feedRemote = ReplicatedStorage:WaitForChild("KillFeed") :: RemoteEvent local gui = Instance.new("ScreenGui") gui.Name = "KillFeed" gui.ResetOnSpawn = false gui.DisplayOrder = 11 gui.Parent = playerGui local stack = Instance.new("Frame") stack.AnchorPoint = Vector2.new(1, 0) stack.Position = UDim2.new(1, -12, 0, 12) stack.Size = UDim2.fromOffset(520, 400) stack.BackgroundTransparency = 1 stack.Parent = gui task.defer(function() local matchHud = playerGui:WaitForChild("ArenaRoundHud", 10) if not matchHud then return end local function placeBelowMatchHud() local base = ((matchHud:GetAttribute("ContentBottom") :: number?) or 72) + 8 stack.Position = UDim2.new(1, -12, 0, base) end matchHud:GetAttributeChangedSignal("ContentBottom"):Connect(placeBelowMatchHud) placeBelowMatchHud() end) local list = Instance.new("UIListLayout") list.HorizontalAlignment = Enum.HorizontalAlignment.Right list.SortOrder = Enum.SortOrder.LayoutOrder list.Padding = UDim.new(0, 6) list.Parent = stack -- the rifle, once: its visible parts in a model, posed side-on (its long axis is X) local rifleModel: Model? = nil do local tool = ReplicatedStorage:WaitForChild("ArenaEquipment"):FindFirstChild("SniperRifle") if tool then local m = Instance.new("Model") for _, p in tool:GetDescendants() do if p:IsA("BasePart") and p.Transparency < 1 then local c = p:Clone() c:ClearAllChildren() c.Anchored = true c.Parent = m end end if #m:GetChildren() > 0 then rifleModel = m end end end local function rifleIcon(parent: Instance, order: number) local vp = Instance.new("ViewportFrame") vp.Size = UDim2.fromOffset(92, 34) vp.BackgroundTransparency = 1 vp.LayoutOrder = order vp.Ambient = Color3.fromRGB(200, 200, 210) vp.LightColor = Color3.new(1, 1, 1) vp.LightDirection = Vector3.new(-0.3, -1, -0.5) vp.Parent = parent local source = rifleModel if not source then return end local m = source:Clone() m.Parent = vp m.WorldPivot = CFrame.new(m:GetPivot().Position) -- world-aligned box local cf, size = m:GetBoundingBox() local cam = Instance.new("Camera") cam.FieldOfView = 20 -- side view (looking along Z), far enough for the length to fill the frame width local halfTan = math.tan(math.rad(cam.FieldOfView / 2)) local dist = math.max((size.X / 2) / (halfTan * 92 / 34), (size.Y / 2) / halfTan) * 1.08 + size.Z / 2 cam.CFrame = CFrame.lookAt(cf.Position + Vector3.zAxis * dist, cf.Position) cam.Parent = vp vp.CurrentCamera = cam end -- headshot: a small crosshair (ring, four ticks, dot) local function headshotIcon(parent: Instance, order: number) local icon = Instance.new("Frame") icon.Size = UDim2.fromOffset(24, 24) icon.BackgroundTransparency = 1 icon.LayoutOrder = order local ring = Instance.new("Frame") ring.AnchorPoint = Vector2.new(0.5, 0.5) ring.Position = UDim2.fromScale(0.5, 0.5) ring.Size = UDim2.fromOffset(15, 15) ring.BackgroundTransparency = 1 local rc = Instance.new("UICorner") rc.CornerRadius = UDim.new(1, 0) rc.Parent = ring local rs = Instance.new("UIStroke") rs.Color = Color3.new(1, 1, 1) rs.Thickness = 2 rs.Parent = ring ring.Parent = icon local function tick(x: number, y: number, w: number, h: number) local f = Instance.new("Frame") f.AnchorPoint = Vector2.new(0.5, 0.5) f.Position = UDim2.new(0.5, x, 0.5, y) f.Size = UDim2.fromOffset(w, h) f.BackgroundColor3 = Color3.new(1, 1, 1) f.BorderSizePixel = 0 f.Parent = icon end tick(0, -10, 2, 6) tick(0, 10, 2, 6) tick(-10, 0, 6, 2) tick(10, 0, 6, 2) tick(0, 0, 3, 3) icon.Parent = parent end local function nameLabel(parent: Instance, text: string, order: number) local l = Instance.new("TextLabel") l.BackgroundTransparency = 1 l.AutomaticSize = Enum.AutomaticSize.XY l.Size = UDim2.new() l.Font = Enum.Font.GothamBold l.Text = text l.TextSize = 15 l.TextColor3 = if order == 1 then UI.Ink else NAME_RED l.LayoutOrder = order local s = Instance.new("UIStroke") s.Color = OUTLINE s.Thickness = 1.5 s.Parent = l l.Parent = parent end local order = 0 local function addRow(killer: string, victim: string, headshot: boolean, own: boolean) order -= 1 -- newest on top local row = Instance.new("CanvasGroup") row.AutomaticSize = Enum.AutomaticSize.X row.Size = UDim2.fromOffset(0, 42) row.BackgroundColor3 = DARK row.BackgroundTransparency = 0.25 row.LayoutOrder = order local c = Instance.new("UICorner") c.CornerRadius = UDim.new(0, 8) c.Parent = row local pad = Instance.new("UIPadding") pad.PaddingLeft = UDim.new(0, 14) pad.PaddingRight = UDim.new(0, 14) pad.Parent = row local layout = Instance.new("UIListLayout") layout.FillDirection = Enum.FillDirection.Horizontal layout.VerticalAlignment = Enum.VerticalAlignment.Center layout.SortOrder = Enum.SortOrder.LayoutOrder layout.Padding = UDim.new(0, 8) layout.Parent = row nameLabel(row, killer, 1) if headshot then headshotIcon(row, 2) end rifleIcon(row, 3) nameLabel(row, victim, 4) -- the player's own kills: a yellow frame (on a holder: a CanvasGroup clips its own stroke) local holder: GuiObject = row if own then local framed = Instance.new("Frame") framed.AutomaticSize = Enum.AutomaticSize.X framed.Size = UDim2.fromOffset(0, 42) framed.BackgroundTransparency = 1 framed.LayoutOrder = order local fc = Instance.new("UICorner") fc.CornerRadius = UDim.new(0, 8) fc.Parent = framed local fs = Instance.new("UIStroke") fs.Color = OWN_FRAME fs.Thickness = 2.5 fs.ApplyStrokeMode = Enum.ApplyStrokeMode.Border fs.Parent = framed row.Parent = framed holder = framed end local scale = Instance.new("UIScale") scale.Scale = 1.25 scale.Parent = holder row.GroupTransparency = 1 holder.Parent = stack TweenService:Create(scale, TweenInfo.new(0.2, Enum.EasingStyle.Back, Enum.EasingDirection.Out), { Scale = 1 }):Play() TweenService:Create(row, TweenInfo.new(0.12), { GroupTransparency = 0 }):Play() -- keep only the newest MAX rows local rows = {} for _, r in stack:GetChildren() do if r:IsA("GuiObject") then table.insert(rows, r) end end table.sort(rows, function(a, b) return a.LayoutOrder < b.LayoutOrder end) for i = MAX + 1, #rows do rows[i]:Destroy() end task.delay(LIFE, function() if not holder.Parent then return end TweenService:Create(row, TweenInfo.new(FADE), { GroupTransparency = 1 }):Play() for _, s in holder:GetChildren() do if s:IsA("UIStroke") then TweenService:Create(s, TweenInfo.new(FADE), { Transparency = 1 }):Play() end end task.wait(FADE) holder:Destroy() end) end local SniperEffects = require(ReplicatedStorage:WaitForChild("SniperEffects")) :: any player:GetAttributeChangedSignal("InArena"):Connect(function() if player:GetAttribute("InArena") == true then return end for _, row in stack:GetChildren() do if row:IsA("GuiObject") then row:Destroy() end end end) feedRemote.OnClientEvent:Connect(function(killer: unknown, victim: unknown, headshot: unknown, killerId: unknown, model: unknown) if player:GetAttribute("InArena") ~= true then return end if typeof(killer) == "string" and typeof(victim) == "string" then addRow(killer, victim, headshot == true, killerId == player.UserId) end -- the victim's body breaks apart in a fiery blast if typeof(model) == "Instance" and model:IsA("Model") then SniperEffects.destroy(model, killerId == player.UserId) end end)