Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would you go about making floating damage text?

Asked by 5 years ago

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.

1
You can use a BillboardGui and parent it to the player's head lunatic5 409 — 5y

1 answer

Log in to vote
-1
Answered by 5 years ago

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) 
0
:connect(), instance.new and the parent argument of Instance.new() is deprecated User#23365 30 — 5y
0
it should work... Am gonna make one tomorrow and test it ten i'll give you the code and tell you where to put it :D User#23252 26 — 5y
Ad

Answer this question