Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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

Log in to vote
1
Answered by 9 years ago
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)

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 User#5978 25 — 9y
0
Thanks so much! Which word would you use in this situation? GatitosMansion 187 — 9y
0
I would use clicks User#5978 25 — 9y
Ad

Answer this question