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

How To Make a Script Where You Click Once It Does Something, But When You Click The Second Time...?

Asked by 8 years ago

How To Make a Script Where You Click Once It Does Something, But When You Click The Second Time It Does Something Else? I tried this, but of course it doesn't work...

function onClicked()
    --Code
    function onClicked()
        --Code
    end
end

script.Parent.MouseButton1Click:connect(onClicked)

Thank You!

1 answer

Log in to vote
1
Answered by 8 years ago

I Would make 1 variable that every time you click something it goes up try this

script.Parent.MouseButton1Click:connect(function()

local clicks = 0
clicks = clicks + 1

code
code
code



if clicks == 2 then

    The Code That you want to do at the second click

end

end)

Ad

Answer this question