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

How to make damage indicators stack?

Asked by 3 years ago
Edited 3 years ago

local script

local damageevent = replicatedstorage.DamageHEAVEN

function hito(partoz, partcfr, magn, dmg, debtim, debtime, bodyfdire, grow, sound, pitch, volume)
  for _, person in pairs(workspace.Entities:GetChildren()) do
    if partoz.Anchored == true then return end
    if person:FindFirstChild("Humanoid") and person:FindFirstChild("HumanoidRootPart") and person ~= chr and magn > (person:FindFirstChild("HumanoidRootPart").Position - partoz.Position).magnitude and person:FindFirstChild("HumanoidRootPart"):FindFirstChild("alabo") == nil then
      do
        if partoz.Anchored then return end
        local humz = person:FindFirstChild("Humanoid")
        local horp = person:FindFirstChild("HumanoidRootPart")
        damageevent:FireServer(humz, partcfr, dmg, debtime, bodyfdire, grow, sound, pitch, volume)
        local db = Instance.new("StringValue")
        db.Name = "alabo"
        db.Parent = horp
        delay(debtim, function()
          db:Destroy()
        end)
      end
    end

if person:FindFirstChild("Stand") and person["Stand"]:FindFirstChild("Stand Torso") and person ~= chr and person ~= chr[stand.Name] and magn > (guy["Stand"]:FindFirstChild("Stand Torso").Position - partoz.Position).magnitude and person:FindFirstChild("HumanoidRootPart"):FindFirstChild("alabo") == nil then
        do 
        if partoz.Anchored then return end
        local humz = person:FindFirstChild("Humanoid")
        local horp = person:FindFirstChild("HumanoidRootPart")
        damageevent:FireServer(humz, partcfr, dmg, debtime, bodyfdire, grow, sound, pitch, volume)
        local db = Instance.new("StringValue")
        db.Name = "alabo"
        db.Parent = horp
        delay(debtim, function()
          db:Destroy()
        end)
      end
    end

  end
end

script

game.ReplicatedStorage.DamageHEAVEN.OnServerEvent:Connect(function(player, hum, partcfr, dmgVal, debtime, bodyfdire, size, soundid, pitch, vol)
local TweenService = game:GetService("TweenService")
    local rd2 = math.random
    local dmg = 10
    local chr = hum.Parent

        local a = Instance.new("BillboardGui", chr["HumanoidRootPart"])
            a.StudsOffset = Vector3.new(0, 0, -2)
            a.StudsOffsetWorldSpace = Vector3.new(0, 0.5, 0)
            a.MaxDistance = 100
            a.AlwaysOnTop = true
            a.Size = UDim2.new(0, 0, 0, 0)
            local b = Instance.new("TextLabel", a)
            local gradiant = Instance.new("UIGradient", b)
            local pink = Color3.new(1, 0.164706, 0.639216)
            local white = Color3.new(1, 1, 1)
            gradiant.Color = ColorSequence.new{
            ColorSequenceKeypoint.new(0, pink),
            ColorSequenceKeypoint.new(0.25, pink),
            ColorSequenceKeypoint.new(1, white)
        }
            gradiant.Rotation = 90
            b.BackgroundTransparency = 1
            dmg = type(dmg) == "number" and math.floor(dmg) or nil
            b.Text = tostring(dmg)
            b.TextColor3 = Color3.new(1, 1, 1)
            b.TextScaled = 50
            b.Font = Enum.Font.Highway
            b.Size = UDim2.new(0.65, 0, 0.65, 0)
            local StudsOffset = TweenService:Create(a, TweenInfo.new(1, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {
StudsOffsetWorldSpace = a.StudsOffsetWorldSpace + Vector3.new(0,    rd2(-5, 2) / 2, 0)
    })
    StudsOffset:Play()
    TweenService:Create(a, TweenInfo.new(1, Enum.EasingStyle.Linear), {
        StudsOffset = a.StudsOffset + Vector3.new(rd2(-20, 20) / 5, 0, 0)
    }):Play()
    TweenService:Create(b, TweenInfo.new(1, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {
        TextTransparency = 1
    }):Play()
    TweenService:Create(b, TweenInfo.new(1, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {
        TextColor3 = Color3.new(1, 0.164706, 0.639216)
    }):Play()
    TweenService:Create(a, TweenInfo.new(1, Enum.EasingStyle.Elastic, Enum.EasingDirection.Out), {
        Size = UDim2.new(3, 0, 2.5, 0) or UDim2.new(3, 0, 1.5, 0)
    }):Play()
    local Goal = {}
    Goal.Rotation = rd2(-30, 30) + 360 * (rd2(0, 1) * 2 - 1) or rd2(-30, 30)
    TweenService:Create(b, TweenInfo.new(1, UDim2.new(3, 0, 2.5, 0) and Enum.EasingStyle.Quad or Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), Goal):Play()
    StudsOffset.Completed:wait()
    a:Destroy()
end)

I got most of this from a tutorial, but i wanted to figure out how to make the text/billboard gui text stack, as in say the player does 10 damage, with the text showing they did 10 damage, but if they do another hit shortly after, the text turns into 20 damage, and doesnt disappear for a bit. I've seen a lot of games achieve this so im curious on learning how to do this.

Answer this question