Made this years ago. I thought I would share it. Its very basic and simple to use and implement into pre-existing games.
All you need to do is add the two remotes inside of the code and place them and move the billboard gui into replicated storage and the local script into starterplayerscripts.
It also comes with support for kill/hit sounds but you can comment that separate code out if you just want to use the indicator.
If you want to do a timed destroy system that utilises tick
then just copy the below code into your script:
DmgIndi.OnClientEvent:Connect(function(damage, target)
local s = tick()
local DamageNumber = nil
--Check if there's already a damage number
DamageNumber = target.Parent.Head:FindFirstChild('DamageNumber')
if DamageNumber == nil then
--There isn't one, make one now
DamageNumber = game:GetService('ReplicatedStorage').DamageNumber:Clone()
else
--There is one, add to it
damage += tonumber(DamageNumber.TextLabel.Text)
end
DamageNumber.Parent = target.Parent.Head
DamageNumber.TextLabel.Text = tostring(damage)
repeat task.wait() until tick() - s >= 5
print(tick() - s >= 5)
DamageNumber:Destroy()
end)
No I wont be adding a preview clip.
Code:
damageIndi.rbxm (6.5 KB)