I've seen this in many games, yet I have no clue how it's done. I'm not asking for any code, just an explanation of how to achieve this.
you can do that by instancing a billboard Gui and placing it in the head of a player that is taking damage.. then instance a a text label and put it in the billboard Gui...
Set the text for the billboard to players max health - player current health.. Then destroy the billboard Gui... Look at the example below
local tool = script.Parent --The tool object local handle = tool.Handle --The handle you hold when you equip the tool Tool.Equipped:connect(function(mouse) mouse.Button1Down:connect(function() local ray = Ray.new(handle.CFrame, (mouse.Hit.p - handle.CFrame.p).Unit * 300) --Bullet(ray) goes 300 studs local part, position = workspace:FindPartOnRay(ray, nil, true,false) if part then if part.Parent:FindFirstChild("Humanoid") then part.Parent.Humanoid:TakeDamage(45) local bill = instance.new("BillBoardGui",part.Parent[Head]) local text = instance.new("TextLabel", bill) text.Text = part.Parent.Humanoid.MaxHealth - part.Parent.Humanoid.Health --This is how its done :D end end end) end)