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

How Do You Make This Script Repeat Itself After The Fourth Click?

How do you make this script repeat itself after the forth click? What it does it stays the same at the forth click. By the way, what is a professional word to label 1 (local Inc = 1) instead of Inc?

local Inc = 1

script.Parent.MouseButton1Click:connect(function()
	if Inc == 1 then --First Click
		--Code
	elseif Inc == 2 then --Second Click
		--Code
	elseif Inc == 3 then --Third Click
		--Code
	elseif Inc == 4 then -- Fourth Click
		--Code
	end
	Inc = Inc + 1
end)

Thank you!

1 answer

✓ Accepted answer
local Inc = 1

script.Parent.MouseButton1Click:connect(function()
    if Inc == 1 then --First Click
        --Code
    elseif Inc == 2 then --Second Click
        --Code
    elseif Inc == 3 then --Third Click
        --Code
    elseif Inc == 4 then -- Fourth Click
        Inc = 0 -- resets it but regards how it adds again at the end
    end
    Inc = Inc + 1
end)

3 comments

0

No such thing as a profresional word for variable as they are variables which are shorter versions as whatever, usually I just name my variables for what they do so in this case clicks

0

Thanks so much! Which word would you use in this situation?

0

I would use clicks

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