Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would you go about making floating damage text?

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 comment

1

You can use a BillboardGui and parent it to the player's head

1 answer


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) 

2 comments

0

:connect(), instance.new and the parent argument of Instance.new() is deprecated

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

This discussion is preserved as it was. New answers, comments, and votes are closed.