Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

3 comments

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.

0

n += n is same as n = n + n

0

yeah i can't do it

This discussion is preserved as it was. New answers, comments, and votes are closed.