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

Why is "n" not adding it's self when i call it in a function?

Asked by 3 years ago
Edited 3 years ago
backup = script.Parent:Clone()
backup.Parent = nil
huma = script.Parent.Humanoid
n = 0.5

huma.Died:Connect(function()
    n += n
    print(n)
    local lolipop = n
    wait(5)
    while lolipop > 0 do    
        backup.Parent = game.Workspace
        lolipop = lolipop - 1
        print(lolipop)
    end
end)

1 answer

Log in to vote
1
Answered by 3 years ago

Because you did the arithmetic wrong, you don't add it directly since roblox wont know what to do, instead you would put it equal to it adding by itself, and if its still erroring I would suggest switching the n to a local n.

backup = script.Parent:Clone()
backup.Parent = nil
huma = script.Parent.Humanoid
n = 0.5

huma.Died:Connect(function()
    n = n + n
    print(n)
    local lolipop = n
    wait(5)
        while lolipop > 0 do   
            backup.Parent = game.Workspace
            lolipop = lolipop - 1
            print(lolipop)
    end
end)

0
i am right now in the middle of making a new wave system i will keep you updated if i can do it. if not ima remove this question. HeroFigo 81 — 3y
0
n += n is same as n = n + n imKirda 4491 — 3y
0
yeah i can't do it HeroFigo 81 — 3y
Ad

Answer this question