Ad
Log in to vote
1

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

Asked by 2 months ago
Edited 2 months 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 2 months 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 38 — 2mo
0
n += n is same as n = n + n imKirda 3167 — 2mo
0
yeah i can't do it HeroFigo 38 — 2mo
Ad

Answer this question