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

this script that displays the damage is not functioning as i'd like it to. what's wrong?

Asked by 5 years ago

Pretty much, I am trying to make a damage script. Say I have a sword, and it deals a different amount of damage each time, like (5, 8, 9). But instead of it displaying the individual amount of damage, it displays the total amount of damage done.

How can I fix, and or what should I add to this script to make it work?

I want this script to display the damage differently each time, but it is just showing the total amount of damage being done.

Info: This script is the parent of a BillboardGui inside an NPC's humanoid.

01local humanoid = script.Parent
02local cHealth = humanoid.Health
03 
04humanoid.HealthChanged:Connect(function(health)
05    local Gui = script.DamageCounter:Clone()
06    local change = math.floor(cHealth - health)
07    if change == 0 then return end
08    Gui.TextLabel.Visible = true
09    Gui.Parent = humanoid.Parent.Head
10    Gui.TextLabel.Text = change
11    wait(1)
12    for i = 0, 1, .1 do
13        Gui.TextLabel.TextTransparency = 1
14        Gui.TextLabel.TextStrokeTransparency = 1
15        wait()
16    end
17end)
0
U want individual numbers that represent the total amount? The_Pr0fessor 595 — 5y
0
no, say i have a sword and it does 8 damage. then it does 10 damage. I want the numbers to display, 8 then 10 but this script would show it as "18" jesusbeef 33 — 5y

Answer this question