local Players = game:GetService("Players") local player = Players.LocalPlayer local animations = { climb = "rbxassetid://129456740734538", fall = "rbxassetid://124250914021743", idle1 = "rbxassetid://75188008607623", idle2 = "rbxassetid://101197238583271", jump = "rbxassetid://74669027858431", run = "rbxassetid://132229099889671", walk = "rbxassetid://82277066511717", swim = "rbxassetid://131372781601692", swimIdle = "rbxassetid://107023958295687" } local function applyAnimations(animate) animate.climb.ClimbAnim.AnimationId = animations.climb animate.fall.FallAnim.AnimationId = animations.fall animate.idle.Animation1.AnimationId = animations.idle1 animate.idle.Animation2.AnimationId = animations.idle2 animate.jump.JumpAnim.AnimationId = animations.jump animate.run.RunAnim.AnimationId = animations.run animate.walk.WalkAnim.AnimationId = animations.walk animate.swim.Swim.AnimationId = animations.swim animate.swimidle.SwimIdle.AnimationId = animations.swimIdle end local function setupAnimations(character) local humanoid = character:WaitForChild("Humanoid") -- Ignore R6 if humanoid.RigType == Enum.HumanoidRigType.R6 then return end local animate = character:WaitForChild("Animate") -- Wait 67 seconds before applying - This right here important btw task.wait(1) -- Apply 5 times in case Roblox reloads Animate for i = 1, 5 do applyAnimations(animate) task.wait(0.5) end end if player.Character then task.spawn(function() setupAnimations(player.Character) end) end player.CharacterAdded:Connect(function(character) task.spawn(function() setupAnimations(character) end) end) local Debris = game:GetService("Debris") -- Create GUI once local damageGui = Instance.new("ScreenGui") damageGui.Name = "DamageGui" damageGui.ResetOnSpawn = false damageGui.IgnoreGuiInset = true damageGui.Parent = player:WaitForChild("PlayerGui") local damageOverlay = Instance.new("Frame") damageOverlay.Size = UDim2.new(1,0,1,0) damageOverlay.Position = UDim2.new(0,0,0,0) damageOverlay.BackgroundColor3 = Color3.fromRGB(255,0,0) damageOverlay.BackgroundTransparency = 1 damageOverlay.BorderSizePixel = 0 damageOverlay.Parent = damageGui local function setup(character) local humanoid = character:WaitForChild("Humanoid") -- Hide red screen when respawning damageOverlay.BackgroundTransparency = 1 humanoid.Died:Connect(function() -- Play death sound local sound = Instance.new("Sound") sound.SoundId = "rbxassetid://18149077638" sound.Volume = 3 sound.Parent = workspace.CurrentCamera sound:Play() Debris:AddItem(sound, 5) -- Show red screen until respawn damageOverlay.BackgroundTransparency = 0.6 end) end if player.Character then setup(player.Character) end player.CharacterAdded:Connect(setup) -- Services local StarterGui = game:GetService("StarterGui") local TweenService = game:GetService("TweenService") -- 1. Disable default Roblox health UI safely task.spawn(function() local success = false while not success do local ok = pcall(function() StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false) end) if ok then success = true else task.wait(0.1) end end end) -- Color Configuration local YELLOW_COLOR = Color3.fromRGB(255, 255, 0) -- Warna kuning utama (Ganti Amber) local CRITICAL_RED = Color3.fromRGB(255, 30, 30) -- DIKEKALKAN: Warna merah untuk teks ketika kritikal local GLOW_FLASH_COLOR = Color3.fromRGB(255, 255, 150) -- Warna kilauan kuning terang -- Background Frame Colors local BG_DEFAULT_COLOR = Color3.fromRGB(20, 20, 20) local BG_FLASH_COLOR = Color3.fromRGB(150, 0, 0) local BG_CRITICAL_COLOR = Color3.fromRGB(40, 10, 10) -- 2. Build HUD Elements Automatically via Code local player = Players.LocalPlayer local pGui = player:WaitForChild("PlayerGui") local screenGui = pGui:FindFirstChild("GModHud") or Instance.new("ScreenGui") screenGui.Name = "GModHud" screenGui.ResetOnSpawn = false screenGui.Parent = pGui local bgFrame = screenGui:FindFirstChild("HudBackground") or Instance.new("Frame") bgFrame.Name = "HudBackground" bgFrame.Size = UDim2.new(0, 180, 0, 55) bgFrame.Position = UDim2.new(0, 20, 1, -75) bgFrame.BackgroundColor3 = BG_DEFAULT_COLOR bgFrame.BackgroundTransparency = 0.8 bgFrame.BorderSizePixel = 0 -- Kekal 0 untuk bentuk petak tanpa garisan luar tepi (border) bgFrame.Parent = screenGui -- DIUBAH: Kod pembuangan UICorner lama dilakukan di sini jika ia wujud daripada versi sebelum ini local oldCorner = bgFrame:FindFirstChildOfClass("UICorner") if oldCorner then oldCorner:Destroy() end -- "HEALTH" text label local healthLabel = bgFrame:FindFirstChild("HealthTextLabel") or Instance.new("TextLabel") healthLabel.Name = "HealthTextLabel" healthLabel.Size = UDim2.new(0, 80, 1, 0) healthLabel.Position = UDim2.new(0, 11, 0, 10) healthLabel.BackgroundTransparency = 1 healthLabel.Text = "HEALTH" healthLabel.TextColor3 = YELLOW_COLOR healthLabel.Font = Enum.Font.SourceSansBold healthLabel.TextSize = 18 healthLabel.TextXAlignment = Enum.TextXAlignment.Left healthLabel.Parent = bgFrame -- Numeric value label local numberLabel = bgFrame:FindFirstChild("NumberLabel") or Instance.new("TextLabel") numberLabel.Name = "NumberLabel" numberLabel.Size = UDim2.new(0, 80, 1, 0) numberLabel.Position = UDim2.new(1, -87, 0, -3) numberLabel.BackgroundTransparency = 1 numberLabel.Text = "100" numberLabel.TextColor3 = YELLOW_COLOR numberLabel.Font = Enum.Font.SourceSans numberLabel.TextSize = 70 numberLabel.TextXAlignment = Enum.TextXAlignment.Right numberLabel.TextStrokeColor3 = GLOW_FLASH_COLOR numberLabel.TextStrokeTransparency = 1 numberLabel.Parent = bgFrame -- 3. Health Tracking & Smooth Transition Logic local previousHealth = 100 local activeTextTween = nil local activeBgTween = nil local activeGlowTween = nil local stateChangeTweens = {} local currentHUDState = "YELLOW" local healthConnections = {} local function cleanupConnections() for _, connection in ipairs(healthConnections) do if connection then connection:Disconnect() end end table.clear(healthConnections) end local function cancelStateTweens() for _, tween in pairs(stateChangeTweens) do if tween then tween:Cancel() end end table.clear(stateChangeTweens) end local function triggerHurtVisuals(isCritical) if activeTextTween then activeTextTween:Cancel() end if activeBgTween then activeBgTween:Cancel() end if activeGlowTween then activeGlowTween:Cancel() end numberLabel.TextTransparency = 0 numberLabel.TextStrokeColor3 = isCritical and CRITICAL_RED or GLOW_FLASH_COLOR numberLabel.TextStrokeTransparency = 0 bgFrame.BackgroundColor3 = BG_FLASH_COLOR bgFrame.BackgroundTransparency = 0.2 local tweenInfo = TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out) local targetBgColor = isCritical and BG_CRITICAL_COLOR or BG_DEFAULT_COLOR activeTextTween = TweenService:Create(numberLabel, tweenInfo, {TextTransparency = 0}) activeGlowTween = TweenService:Create(numberLabel, tweenInfo, {TextStrokeTransparency = 1}) activeBgTween = TweenService:Create(bgFrame, tweenInfo, { BackgroundColor3 = targetBgColor, BackgroundTransparency = 0.4 }) activeTextTween:Play() activeGlowTween:Play() activeBgTween:Play() end local function transitionToState(targetState) if currentHUDState == targetState then return end currentHUDState = targetState cancelStateTweens() local blendInfo = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out) if targetState == "RED" then stateChangeTweens.Text = TweenService:Create(numberLabel, blendInfo, {TextColor3 = CRITICAL_RED}) stateChangeTweens.Label = TweenService:Create(healthLabel, blendInfo, {TextColor3 = CRITICAL_RED}) stateChangeTweens.Bg = TweenService:Create(bgFrame, blendInfo, { BackgroundColor3 = BG_CRITICAL_COLOR, BackgroundTransparency = 0.4 }) else stateChangeTweens.Text = TweenService:Create(numberLabel, blendInfo, {TextColor3 = YELLOW_COLOR}) stateChangeTweens.Label = TweenService:Create(healthLabel, blendInfo, {TextColor3 = YELLOW_COLOR}) stateChangeTweens.Bg = TweenService:Create(bgFrame, blendInfo, { BackgroundColor3 = BG_DEFAULT_COLOR, BackgroundTransparency = 0.4 }) end for _, tween in pairs(stateChangeTweens) do tween:Play() end end local function watchPlayerHealth(character) cleanupConnections() local humanoid = character:WaitForChild("Humanoid", 10) if not humanoid then return end cancelStateTweens() if activeTextTween then activeTextTween:Cancel() end if activeBgTween then activeBgTween:Cancel() end if activeGlowTween then activeGlowTween:Cancel() end previousHealth = humanoid.Health currentHUDState = "RESET" local function updateDisplay() local hp = math.max(0, math.floor(humanoid.Health)) numberLabel.Text = tostring(hp) local isLowHp = (hp <= 10) if hp < previousHealth then triggerHurtVisuals(isLowHp) end if isLowHp then transitionToState("RED") else transitionToState("YELLOW") end previousHealth = hp end updateDisplay() table.insert(healthConnections, humanoid.HealthChanged:Connect(updateDisplay)) table.insert(healthConnections, humanoid.Died:Connect(function() cleanupConnections() numberLabel.Text = "0" transitionToState("RED") triggerHurtVisuals(true) end)) end if player.Character then task.spawn(watchPlayerHealth, player.Character) end player.CharacterAdded:Connect(watchPlayerHealth)