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

Basic Scripter here, I need help With this Function, Whats Wrong ???

I'm trying to make it increase one every sec but when at 10 it goes back to zero

function ifit()
	while wait do
		NUM = 1
		Answer = NUM + 1
	end
	if Answer == 10 then
		Answer = 0
	end
end

ifit()

2 answers

✓ Accepted answer

You can use the break function

function ifit()
    while wait() do
        NUM = 1
        Answer = NUM + 1
        if Answer == 10 then
            Answer = 0
        	break
		end
    end
end

ifit()

If that does not work, you could try the repeat function.

local NUM = 0
local Answer = 0 

function ifit()
	NUM = 1
    repeat
		wait()
        Answer = NUM + 1
		NUM = Answer
		print(Answer)
    until Answer == 10
end

ifit()

I'm typing this on phone right now so ignore any typos, but, you can simply just do this:

answer = 0
function ifit()
if answer == 0 then
     for i = 0, 10 do
           answer = i 
           wait(1)
     end
end
wait(11)
if answer == 10 then
     answer = 0
 end
end

while true do
wait(11)
ifit()
end

If you already know what this does, great! Just contact me on roblox if you need an explanation. My username is: ioserswinger Also please note, I'm not very advanced yet either

1 comment

0

username on my profile is wrong btw

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