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

How do I make a popup damage GUI when I hit an NPC?

Asked by 5 years ago

I want to make when you hit an NPC with a weapon, it shows up a number for how many damages have you dealt. I tried to create it with a part the same time I hit, but it seems to show up the part with the number. I tried using force field as well but it still showing up the force field with a shiny yellow look. How do I make this shows up without a part? Here is the code that I'm currently using:

local function CreateObject(hit,dmg) 
    local damage                          = Instance.new("Model",game.Workspace)
    local dameges                              = Instance.new("Part",ObjModel)
    dameges.BrickColor                           = BrickColor.new("Pastel yellow")
    damages.Material                             = "ForceField"
damages.Transparency                         = 1
  damages.Position                             = hit.Parent:FindFirstChild("Head").Position + Vector3.new(math.random(-1.6,1.6),2,math.random(-1.6,1.6))
    damages.Anchored                             = true
    damages.CanCollide                           = false
 damages.Shape                                = "Ball"
    damages.Size                                 = Vector3.new(.75,.75,.75) -- cant change this because it'll also changes the size of the text, making it extra small
    local GUI                                = script.BillboardGui:Clone() 
    GUI.Adornee                              = damages
    local Even                               = math.floor(dmg + .5)
    GUI.TextLabel.Text                       = Even.." Damage"
    GUI.Parent                               = damage

    local damagepos                             = Instance.new("BodyPosition",Obj)
    damagepos.Position                          = Vector3.new(0,7,0)
    for i = 1,0, -.1 do
        damages.Transparency                     = i
        GUI.TextLabel.TextTransparency       = i
        GUI.TextLabel.TextStrokeTransparency = i
        wait()
    end
    wait(.5)
    for i = 0,1, .1 do
       damages.Transparency                     = i
        GUI.TextLabel.TextTransparency       = i
        GUI.TextLabel.TextStrokeTransparency = i
        wait()
    end
    return damage
end
0
Feel like our syntax highlighter isn't helping the look of your question. M39a9am3R 3210 — 5y
0
? MinuhaYT 19 — 5y

Answer this question