Help on Multiplication

I am a beginner developer and I am trying to multiply values with numbers and doesn’t seem to work.
No errors are present in the output so I can only guess I don’t know how to multiply in Roblox Studio.

local function levelUp()
	if current.Value == max.Value then
		levelUp = true
		if levelUp == true then
			level.Value = level.Value + 1
			wait(1)
			current.Value = 0
			max.Value = max.Value * 2
		end
	end
end

Any help would be great thanks!

1 Like

This is not your solution, but I recommend changing

to

level.Value += 1

What is max.Value? Is it defined somewhere else? Also, for multiplication you use *

Yes, max.Value is defined my problem is the multiplying. And I used the * and nothing happened. Thanks for trying though!

well if max’s value is 0 then 0 * 2 is equal to 0, maybe do this:

-- basically a way to make an if stratment while setting a value
max.Value = max.Value > 0 and max.Value * 2 or 1

Max.Value = 100 so it’s not that sadly.

Im not sure, but the name max looks like a part of the system (its blue). Try renaming it to something else. Also, print around the code to check if everything is running.

well are you sure that the if statment is true?

Thanks! It has worked now and is running once making a few adjustments. Thanks a lot!

1 Like