This commit is contained in:
listik committed 2026-11-29 15:49:17 +03:00
commit a85391509d
211 files changed
+28903

No files matched your search

+119
View File
@@ -0,0 +1,119 @@
--!strict
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")
local TweenService = game:GetService("TweenService")
local UI = require(ReplicatedStorage:WaitForChild("HunterUI") :: ModuleScript)
local YELLOW = Color3.fromRGB(255, 194, 70)
local RED = Color3.fromRGB(250, 80, 82)
local player = Players.LocalPlayer
task.spawn(function()
for _ = 1, 20 do
if pcall(StarterGui.SetCoreGuiEnabled, StarterGui, Enum.CoreGuiType.Health, false) then
break
end
task.wait(0.5)
end
end)
local gui = Instance.new("ScreenGui")
gui.Name = "HealthBar"
gui.ResetOnSpawn = false
gui.DisplayOrder = 10
gui.Enabled = player:GetAttribute("InArena") == true
gui.Parent = player:WaitForChild("PlayerGui")
player:GetAttributeChangedSignal("InArena"):Connect(function()
gui.Enabled = player:GetAttribute("InArena") == true
end)
local plate = UI.plate(gui, "Health", UDim2.new(0, 15, 1, -16), UDim2.new(.46, 0, 0, 49), UI.Outline)
local lightning = UI.contour(plate, UI.Mint)
plate.AnchorPoint = Vector2.new(0, 1)
local limit = Instance.new("UISizeConstraint", plate)
limit.MaxSize = Vector2.new(350, 49)
local function fit()
local width = gui.AbsoluteSize.X
if width > 0 then
plate.Size = UDim2.fromOffset(math.max(120, math.min(width * .46, width - 221, 350)), 49)
end
end
gui:GetPropertyChangedSignal("AbsoluteSize"):Connect(fit)
fit()
local shield = UI.element("Shield", plate, UDim2.fromOffset(14, 13), nil)
Instance.new("UIScale", shield).Scale = 1.13
local text = UI.label(plate, "Value", "100", UDim2.fromOffset(46, 0), UDim2.fromOffset(55, 49), 24, UI.Ink)
text.FontFace = UI.Display
text.TextXAlignment = Enum.TextXAlignment.Left
local track = UI.element("ProgressBar", plate, UDim2.fromOffset(100, 17), UDim2.new(1, -117, 0, 15))
local fill = track:WaitForChild("Fill") :: Frame
local lag = UI.frame("DamageTrail", track, UDim2.fromScale(0, 0), UDim2.fromScale(1, 1), UI.Ink)
lag.BackgroundTransparency = .37
fill.ZIndex = 2
UI.sheen(fill)
local function colorFor(r: number): Color3
if r > 0.5 then
return YELLOW:Lerp(UI.Mint, math.clamp((r - .5) / .31, 0, 1))
end
return RED:Lerp(YELLOW, r * 2)
end
local lastHealth: number? = nil
local fillTween: Tween? = nil
local lagTween: Tween? = nil
local conns: { RBXScriptConnection } = {}
local function update(humanoid: Humanoid)
local max = math.max(humanoid.MaxHealth, 1)
local hp = math.clamp(humanoid.Health, 0, max)
local r = hp / max
text.Text = tostring(math.ceil(hp))
local tint = colorFor(r)
lightning:SetAttribute("Accent", tint)
if fillTween then fillTween:Cancel() end
if lagTween then lagTween:Cancel() end
if lastHealth then
local damaged = hp < lastHealth
if damaged then fill.BackgroundColor3 = UI.Ink end
fillTween = TweenService:Create(fill, TweenInfo.new(.18, Enum.EasingStyle.Quart), {
Size = UDim2.fromScale(r, 1), BackgroundColor3 = tint,
})
lagTween = TweenService:Create(lag, TweenInfo.new(.42, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, if damaged then .18 else 0), {
Size = UDim2.fromScale(r, 1),
})
fillTween:Play()
lagTween:Play()
else
fill.Size = UDim2.fromScale(r, 1)
fill.BackgroundColor3 = tint
lag.Size = fill.Size
end
lastHealth = hp
end
local function onCharacter(character: Model)
local humanoid = character:WaitForChild("Humanoid", 10) :: Humanoid?
if not humanoid then
return
end
for _, cn in conns do
cn:Disconnect()
end
table.clear(conns)
lastHealth = nil
update(humanoid)
table.insert(conns, humanoid.HealthChanged:Connect(function()
update(humanoid)
end))
table.insert(conns, humanoid:GetPropertyChangedSignal("MaxHealth"):Connect(function()
update(humanoid)
end))
end
player.CharacterAdded:Connect(onCharacter)
if player.Character then
onCharacter(player.Character)
end