I am currently making a game that has the players click a button, each time they click the button they progress a stage and something new happens when they click the button. I have came up with a way to make this work, although it seems pretty inefficient and I was wondering if there was a better way to do it, cheers!
local stage = 0
local button = workspace.Button
button.ClickDetector.MouseClick:Connect(function()
if stage == 0 then
-- do stuff
stage = stage + 1
end
if stage == 1 then
-- do stuff
stage = stage + 1
end
if stage == 2 then
-- do stuff
stage = stage + 1
end
-- And so on and so forth.
end)