Trying to make stacking damage numbers

So I’m making a gun system and everything is complete; except for damage feedback. I’ve been trying to make damage indicators that stack damage rather than throw out 50 numbers; sort of like how TF2 and Jailbreak’s hit feedback works. 90% of the code I have is wired into RemoteEvents and such; so I can’t really give a good example of what my code looks like.

Could someone possibly be the best person on earth and provide a code snipet on how to achieve this? It doesn’t have to be neat, just functional. Again, very sorry I can’t provide any code.

So I’m assuming your damage indicators are on the client side? If so this should be relatively easy, here’s some pseudocode:

currentgui = nil
num = 0
function showdamage(damage, person)
    if not currentgui then
        local gui = makegui(damage, person)
        currentgui = gui
    else
        changeguinumber(gui, damage)
    end
    local localnum = num
    delay(1, function()
        if localnum == num then
            gui:Destroy()
            currentgui = nil
        end
    end)
end

Hope this helps!

2 Likes

Thank you so much! It took a bit to comprehend how simple this was lol.