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

Trying to do Burn Damage but the For Loop only goes to 8 or 7 and not 20?

Asked by 6 years ago
Edited 6 years ago

I'm trying to do this thing with Burn Damage with a for loop but for some reason, It only goes to about 7 or 8 and doesn't go to 20...?

Anyone know whats going on?

CODE:

local Char = game.Players.LocalPlayer.Character["Left Arm"]
local player = game.Players.LocalPlayer
local damage = game.Players.LocalPlayer.leaderstats.Strength.Value + game.Players.LocalPlayer.leaderstats2.Damage.Value --How much it damages
local db = false --Debounce

Char.Touched:Connect(function(hit) --Touched event 'hit' is what touched
    --make sure it's not yourself
    if hit:IsDescendantOf(Char.Parent) then return end
    if not db then
        db = true
        local h = hit.Parent:FindFirstChild("Humanoid") --Check for humanoid
        local he = hit.Parent:FindFirstChild("Head") --Check for Head
        if h then
            h:TakeDamage(damage) --Damage player
            script.Parent.DamageText:Clone().Parent = he
            script.Parent.PSound:Clone().Parent = Char
            Char.PSound:Play()
            he.DamageText.Text.Text = damage


            if player.leaderstats2.Power.Value == "Flame" and player.leaderstats2.Power.PowerEn.Value == true then
                for i = 1,20 do
                    if he:FindFirstChild("Damage Text") then
                    he:FindFirstChild("DamageText"):Destroy()
                    else
                        script.Parent.DamageText:Clone().Parent = he
                    end
                    local FlameDamage = math.random(1, damage)
                    h:TakeDamage(FlameDamage) --Damage player
                    he.DamageText.Text.Text = "Burn Damage: "..FlameDamage
                    for g,f in pairs(hit.Parent:getChildren()) do
                        if f:IsA("Part") then
                            if not f:FindFirstChild(player.leaderstats2.Power.Value) then
                                game.Lighting:FindFirstChild(player.leaderstats2.Power.Value):Clone().Parent = f
                            end
                        end
                    end
                    wait(0.3)
                end



            wait()
            he.DamageText.Text.TextTransparency = 0.1
            he.DamageText.Text.TextStrokeTransparency = 0.1
            wait()
            he.DamageText.Text.TextTransparency = 0.2
            he.DamageText.Text.TextStrokeTransparency = 0.2
            wait()
            he.DamageText.Text.TextTransparency = 0.3
            he.DamageText.Text.TextStrokeTransparency = 0.3
            wait()
            he.DamageText.Text.TextTransparency = 0.4
            he.DamageText.Text.TextStrokeTransparency = 0.4
            wait()
            he.DamageText.Text.TextTransparency = 0.5
            he.DamageText.Text.TextStrokeTransparency = 0.5
            wait()
            he.DamageText.Text.TextTransparency = 0.6
            he.DamageText.Text.TextStrokeTransparency = 0.6
            wait()
            he.DamageText.Text.TextTransparency = 0.7
            he.DamageText.Text.TextStrokeTransparency = 0.7
            wait()
            he.DamageText.Text.TextTransparency = 0.8
            he.DamageText.Text.TextStrokeTransparency = 0.8
            wait()
            he.DamageText.Text.TextTransparency = 0.9
            he.DamageText.Text.TextStrokeTransparency = 0.9
            wait()
            he.DamageText.Text.TextTransparency = 1
            he.DamageText.Text.TextStrokeTransparency = 1
            he.DamageText:Destroy()
            else




            wait()
            he.DamageText.Text.TextTransparency = 0.1
            he.DamageText.Text.TextStrokeTransparency = 0.1
            wait()
            he.DamageText.Text.TextTransparency = 0.2
            he.DamageText.Text.TextStrokeTransparency = 0.2
            wait()
            he.DamageText.Text.TextTransparency = 0.3
            he.DamageText.Text.TextStrokeTransparency = 0.3
            wait()
            he.DamageText.Text.TextTransparency = 0.4
            he.DamageText.Text.TextStrokeTransparency = 0.4
            wait()
            he.DamageText.Text.TextTransparency = 0.5
            he.DamageText.Text.TextStrokeTransparency = 0.5
            wait()
            he.DamageText.Text.TextTransparency = 0.6
            he.DamageText.Text.TextStrokeTransparency = 0.6
            wait()
            he.DamageText.Text.TextTransparency = 0.7
            he.DamageText.Text.TextStrokeTransparency = 0.7
            wait()
            he.DamageText.Text.TextTransparency = 0.8
            he.DamageText.Text.TextStrokeTransparency = 0.8
            wait()
            he.DamageText.Text.TextTransparency = 0.9
            he.DamageText.Text.TextStrokeTransparency = 0.9
            wait()
            he.DamageText.Text.TextTransparency = 1
            he.DamageText.Text.TextStrokeTransparency = 1
            he.DamageText:Destroy()
            end
          end
        end
        db = false
end)
    end
                    end
                    wait(0.3)
                end
0
W001: Unknown global "he" hiimgoodpack 2009 — 6y
0
yeah, he isn't a thing in lua unless it is a variable greatneil80 2647 — 6y
0
I only posted a bit of the needed code, He is defined in the actual script. DeveloPatter 23 — 6y
0
You also didn't post some needed code. hiimgoodpack 2009 — 6y
View all comments (2 more)
0
There, I posted the whole code DeveloPatter 23 — 6y
0
Line 43 - 108 could be simplified with a for loop saSlol2436 716 — 6y

Answer this question